feat add rxcpp v4.1.1
This commit is contained in:
parent
d161cb6a6f
commit
08a9211c5b
9
3party/rxcpp/.editorconfig
Normal file
9
3party/rxcpp/.editorconfig
Normal file
@ -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
|
63
3party/rxcpp/.gitattributes
vendored
Normal file
63
3party/rxcpp/.gitattributes
vendored
Normal file
@ -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
|
140
3party/rxcpp/.gitignore
vendored
Normal file
140
3party/rxcpp/.gitignore
vendored
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
#################
|
||||||
|
## 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
|
||||||
|
############
|
||||||
|
|
||||||
|
build/*
|
||||||
|
dest/*
|
||||||
|
.vscode/*
|
||||||
|
nmake/*
|
||||||
|
projects/*
|
||||||
|
!projects/CMake/CMakeLists.txt
|
||||||
|
!projects/CMake/shared.cmake
|
||||||
|
!projects/nuget/rxcpp.autopackage
|
||||||
|
!projects/doxygen
|
||||||
|
!projects/scripts
|
||||||
|
Testing/*
|
||||||
|
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles
|
||||||
|
*.cmake
|
||||||
|
*.log
|
||||||
|
*.vcxproj*
|
||||||
|
*.sln
|
||||||
|
Makefile
|
||||||
|
|
||||||
|
############
|
||||||
|
## Sublime
|
||||||
|
############
|
||||||
|
|
||||||
|
*.sublime-*
|
||||||
|
|
||||||
|
############
|
||||||
|
## Doxygen
|
||||||
|
############
|
||||||
|
|
||||||
|
projects/doxygen/*.conf
|
||||||
|
projects/doxygen/html
|
||||||
|
Rx/v2/examples/doxygen/output.txt
|
3
3party/rxcpp/.gitmodules
vendored
Normal file
3
3party/rxcpp/.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "ext/catch"]
|
||||||
|
path = ext/catch
|
||||||
|
url = https://github.com/philsquared/Catch.git
|
219
3party/rxcpp/.travis.yml
Normal file
219
3party/rxcpp/.travis.yml
Normal file
@ -0,0 +1,219 @@
|
|||||||
|
language: cpp
|
||||||
|
|
||||||
|
dist: trusty
|
||||||
|
sudo: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
secure: FNZOWYO89qsT9kQKngrYbpnqCTMCSCSQ2rnZ3l17KHctOfS554TTDS+dfxPYz2XHm6azYDVcyBSs2gWJ6TmXZZZqEfr3X4VV4ooAa9PoeIkvVlT654zjZwxeXPYXrHFXZh/ImLUGWjsxRaUHYOv5SzyNGcZv07dtLKVd0ykhbH4=
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
|
||||||
|
- env: BUILD_TYPE=Debug ASAN=Off RUN_TEST=On EXCEPTIONS=On
|
||||||
|
os: osx
|
||||||
|
osx_image: xcode8
|
||||||
|
|
||||||
|
- env: BUILD_TYPE=Debug ASAN=Off LLVM_VERSION=3.8.0 RUN_TEST=On EXCEPTIONS=On
|
||||||
|
os: linux
|
||||||
|
compiler: clang
|
||||||
|
|
||||||
|
- env: BUILD_TYPE=Release ASAN=Off GCC_VERSION=4.9 RUN_TEST=On EXCEPTIONS=On
|
||||||
|
os: linux
|
||||||
|
compiler: gcc
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-4.9
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- env: BUILD_TYPE=Release ASAN=Off GCC_VERSION=7 RUN_TEST=On EXCEPTIONS=On
|
||||||
|
os: linux
|
||||||
|
compiler: gcc
|
||||||
|
addons: &gcc7
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-7
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- env: BUILD_TYPE=Debug ASAN=Off GCC_VERSION=8 RUN_TEST=On EXCEPTIONS=Off
|
||||||
|
os: linux
|
||||||
|
compiler: gcc
|
||||||
|
addons: &gcc8
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-8
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- env: BUILD_TYPE=Release ASAN=Off GCC_VERSION=8 RUN_TEST=On EXCEPTIONS=On
|
||||||
|
os: linux
|
||||||
|
compiler: gcc
|
||||||
|
addons: &gcc8
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-8
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- env: BUILD_TYPE=Debug ASAN=Off LLVM_VERSION=3.8.0 RUN_TEST=Off EXCEPTIONS=On PROJECT=doc PUBLISH_DOCS=On DOXYGEN_VERSION=1.8.11
|
||||||
|
os: linux
|
||||||
|
compiler: clang
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- graphviz
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.8.0
|
||||||
|
- ${TRAVIS_BUILD_DIR}/deps/cmake-3.5.2
|
||||||
|
- ${TRAVIS_BUILD_DIR}/deps/doxygen-1.8.11
|
||||||
|
|
||||||
|
install:
|
||||||
|
############################################################################
|
||||||
|
# All the dependencies are installed in ${TRAVIS_BUILD_DIR}/deps/
|
||||||
|
############################################################################
|
||||||
|
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
|
||||||
|
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
# Install Clang, libc++ and libc++abi
|
||||||
|
############################################################################
|
||||||
|
- |
|
||||||
|
if [[ "${LLVM_VERSION}" != "" ]]; then
|
||||||
|
LLVM_DIR=${DEPS_DIR}/llvm-${LLVM_VERSION}
|
||||||
|
if [[ -z "$(ls -A ${LLVM_DIR})" ]]; then
|
||||||
|
LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
|
||||||
|
LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz"
|
||||||
|
LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz"
|
||||||
|
CLANG_URL="http://llvm.org/releases/${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz"
|
||||||
|
mkdir -p ${LLVM_DIR} ${LLVM_DIR}/build ${LLVM_DIR}/projects/libcxx ${LLVM_DIR}/projects/libcxxabi ${LLVM_DIR}/clang
|
||||||
|
travis_retry wget --quiet -O - ${LLVM_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}
|
||||||
|
travis_retry wget --quiet -O - ${LIBCXX_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/projects/libcxx
|
||||||
|
travis_retry wget --quiet -O - ${LIBCXXABI_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/projects/libcxxabi
|
||||||
|
travis_retry wget --quiet -O - ${CLANG_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/clang
|
||||||
|
(cd ${LLVM_DIR}/build && cmake .. -DCMAKE_INSTALL_PREFIX=${LLVM_DIR}/install -DCMAKE_CXX_COMPILER=clang++)
|
||||||
|
(cd ${LLVM_DIR}/build/projects/libcxx && make install -j2)
|
||||||
|
(cd ${LLVM_DIR}/build/projects/libcxxabi && make install -j2)
|
||||||
|
fi
|
||||||
|
export CXXFLAGS="-nostdinc++ -isystem ${LLVM_DIR}/install/include/c++/v1"
|
||||||
|
export LDFLAGS="-L ${LLVM_DIR}/install/lib -l c++ -l c++abi"
|
||||||
|
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_DIR}/install/lib"
|
||||||
|
export PATH="${LLVM_DIR}/clang/bin:${PATH}"
|
||||||
|
$LLVM_DIR/clang/bin/clang++ --version
|
||||||
|
fi
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
# Use gcc
|
||||||
|
############################################################################
|
||||||
|
- |
|
||||||
|
if [ -n "$GCC_VERSION" ]; then
|
||||||
|
export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}";
|
||||||
|
g++-${GCC_VERSION} --version
|
||||||
|
fi
|
||||||
|
|
||||||
|
- $CXX --version
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
# Install a recent Doxygen
|
||||||
|
############################################################################
|
||||||
|
- |
|
||||||
|
if [ -n "$DOXYGEN_VERSION" ]; then
|
||||||
|
DOXYGEN_DIR=${DEPS_DIR}/doxygen-${DOXYGEN_VERSION}
|
||||||
|
if [[ -z "$(ls -A ${DOXYGEN_DIR})" ]]; then
|
||||||
|
DOXYGEN_URL="https://downloads.sourceforge.net/doxygen/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz"
|
||||||
|
mkdir -p ${DOXYGEN_DIR} && travis_retry wget --quiet -O - ${DOXYGEN_URL} | tar --strip-components=1 -xz -C ${DOXYGEN_DIR}
|
||||||
|
fi
|
||||||
|
export PATH=${DOXYGEN_DIR}/bin:${PATH}
|
||||||
|
doxygen --version
|
||||||
|
fi
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
# Install a recent CMake (unless already installed on OS X)
|
||||||
|
############################################################################
|
||||||
|
- |
|
||||||
|
if [ -z "$CMAKE_VERSION" ]; then
|
||||||
|
CMAKE_VERSION=3.5.2;
|
||||||
|
fi;
|
||||||
|
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
|
||||||
|
CMAKE_DIR=${DEPS_DIR}/cmake-${CMAKE_VERSION}
|
||||||
|
if [[ -z "$(ls -A ${CMAKE_DIR})" ]]; then
|
||||||
|
CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz"
|
||||||
|
mkdir -p ${CMAKE_DIR} && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR}
|
||||||
|
fi
|
||||||
|
export PATH=${CMAKE_DIR}/bin:${PATH}
|
||||||
|
else
|
||||||
|
if ! brew ls --version cmake &>/dev/null; then brew install cmake; fi
|
||||||
|
fi
|
||||||
|
cmake --version
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- |
|
||||||
|
if [ -z "$BUILD_TYPE" ]; then
|
||||||
|
BUILD_TYPE=Release;
|
||||||
|
fi;
|
||||||
|
if [ -z "$EXCEPTIONS" ]; then
|
||||||
|
EXCEPTIONS=On;
|
||||||
|
fi;
|
||||||
|
if [[ "${ASAN}" == "On" ]]; then
|
||||||
|
export CXXFLAGS="${CXXFLAGS} -fsanitize=address,undefined,integer -fno-omit-frame-pointer -fno-sanitize=unsigned-integer-overflow";
|
||||||
|
fi;
|
||||||
|
if [ -n "$LLVM_VERSION" ]; then
|
||||||
|
export CXXFLAGS="${CXXFLAGS} -D__extern_always_inline=inline";
|
||||||
|
fi;
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
# generate build
|
||||||
|
############################################################################
|
||||||
|
- cd ${TRAVIS_BUILD_DIR}
|
||||||
|
- cmake . -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DRX_USE_EXCEPTIONS=${EXCEPTIONS}
|
||||||
|
|
||||||
|
script:
|
||||||
|
############################################################################
|
||||||
|
# Run build
|
||||||
|
############################################################################
|
||||||
|
- make VERBOSE=1 $PROJECT
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
# Test build
|
||||||
|
############################################################################
|
||||||
|
- cd build/test/
|
||||||
|
- if [[ "${RUN_TEST}" == "On" ]]; then ctest -V; fi
|
||||||
|
- cd ../../
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
############################################################################
|
||||||
|
# Publish documentation
|
||||||
|
############################################################################
|
||||||
|
- |
|
||||||
|
if [[ "${PUBLISH_DOCS}" == "On" ]]; then
|
||||||
|
sh projects/scripts/travis-doxygen.sh;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
email:
|
||||||
|
recipients:
|
||||||
|
- kirk.shoop@microsoft.com
|
||||||
|
on_success: always
|
||||||
|
on_failure: always
|
||||||
|
slack: reactivex:eq4FFCchRIzufO2ZmpuuiJ9E
|
||||||
|
webhooks:
|
||||||
|
urls:
|
||||||
|
- https://webhooks.gitter.im/e/fcf05f21f5d4102e12e7
|
||||||
|
deploy:
|
||||||
|
- provider: releases
|
||||||
|
api_key:
|
||||||
|
secure: sMyo0U4WxZ0kOlQ9SzKfeuU2/5y0Ngt8A0B0N6bb0TcGIyLhQv2q216Q+T0rkQKc04WnLY0Vr1/q9LonAA46nGq7zAiWcC3TY0zVUKRmKWrotQb/QqW1tvVEARKwG7CO+HCcGT3XCeM69XA/L7WiXRskTxS1+5Vy46/tVZBKofg=
|
||||||
|
file: ''
|
||||||
|
on:
|
||||||
|
tags: true
|
||||||
|
repo: Reactive-Extensions/RxCpp
|
41
3party/rxcpp/AUTHORS.txt
Normal file
41
3party/rxcpp/AUTHORS.txt
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
List of contributors to the Rx libraries
|
||||||
|
|
||||||
|
Rx and Ix.NET:
|
||||||
|
Wes Dyer
|
||||||
|
Jeffrey van Gogh
|
||||||
|
Matthew Podwysocki
|
||||||
|
Bart de Smet
|
||||||
|
Danny van Velzen
|
||||||
|
Erik Meijer
|
||||||
|
Brian Beckman
|
||||||
|
Aaron Lahman
|
||||||
|
Georgi Chkodrov
|
||||||
|
Arthur Watson
|
||||||
|
Gert Drapers
|
||||||
|
Mark Shields
|
||||||
|
|
||||||
|
Rx.js and Ix.js:
|
||||||
|
Matthew Podwysocki
|
||||||
|
Jeffrey van Gogh
|
||||||
|
Bart de Smet
|
||||||
|
Brian Beckman
|
||||||
|
Wes Dyer
|
||||||
|
Erik Meijer
|
||||||
|
|
||||||
|
Tx:
|
||||||
|
Georgi Chkodrov
|
||||||
|
Bart de Smet
|
||||||
|
Aaron Lahman
|
||||||
|
Erik Meijer
|
||||||
|
Brian Grunkemeyer
|
||||||
|
Beysim Sezgin
|
||||||
|
Tiho Tarnavski
|
||||||
|
Collin Meek
|
||||||
|
Sajay Anthony
|
||||||
|
Karen Albrecht
|
||||||
|
John Allen
|
||||||
|
Zach Kramer
|
||||||
|
|
||||||
|
Rx++ and Ix++:
|
||||||
|
Aaron Lahman
|
||||||
|
Kirk Shoop
|
5
3party/rxcpp/CMakeLists.txt
Normal file
5
3party/rxcpp/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
|
||||||
|
|
||||||
|
# define some folders
|
||||||
|
|
||||||
|
add_subdirectory(projects/CMake build)
|
32
3party/rxcpp/DeveloperManual.md
Normal file
32
3party/rxcpp/DeveloperManual.md
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# Developer Manual
|
||||||
|
|
||||||
|
## Some comments on the scheduler system
|
||||||
|
|
||||||
|
The scheduler in rxcpp v2 is based on the scheduler and worker constructs that *RxJava* uses (Eric Meijer was involved) The docs for *RxJava* will have an explanation for ```scheduler``` and ```worker```. RxCpp adds ```schedulable```, ```coordination``` and ```coordinator```.
|
||||||
|
|
||||||
|
```scheduler``` owns a timeline that is exposed by the ```now()``` method. ```scheduler``` is also a factory for workers in that timeline. Since a scheduler owns a timeline it is possible to build schedulers that time-travel. The virtual-scheduler is a base for the test-scheduler that uses this to make multi-second tests complete in ms.
|
||||||
|
|
||||||
|
```worker``` owns a queue of pending ```schedulable```s for the timeline and has a lifetime. When the time for an ```schedulable``` is reached the ```schedulable``` is run. The queue maintains insertion order so that when N ```schedulable```s have the same target time they are run in the order that they were inserted into the queue. The ```worker``` guarantees that each ```schedulable``` completes before the next ```schedulable``` is started. when the ```worker```'s lifetime is unsubscribed all pending ```schedulable```s are discarded.
|
||||||
|
|
||||||
|
```schedulable``` owns a function and has a ```worker``` and a ```lifetime```. When the ```schedulable```'s ```lifetime``` is unsubscribed the ```schedulable``` function will not be called. The ```schedulable``` is passed to the function and allows the function to reschedule itself or schedule something else on the same worker.
|
||||||
|
|
||||||
|
The new concepts are ```coordination``` and ```coordinator```. I added these to simplify operator implementations and to introduce pay-for-use in operator implementations. Specifically, in Rx.NET and RxJava, the operators use atomic operations and synchronization primitives to coordinate messages from multiple streams even when all the streams are on the same thread (like UI events). The ```identity_...``` coordinations in RxCpp are used by default and have no overhead. The ```syncronize_...``` and ```observe_on_...``` coordinations use mutex and queue-onto-a-worker respectively, to interleave multiple streams safely.
|
||||||
|
|
||||||
|
```coordination``` is a factory for ```coordinator```s and has a scheduler.
|
||||||
|
|
||||||
|
```coordinator``` has a ```worker```, and is a factory for coordinated observables, subscribers and schedulable functions.
|
||||||
|
|
||||||
|
All the operators that take multiple streams or deal in time (even ```subscribe_on``` and ```observe_on```) take a coordination parameter, not scheduler.
|
||||||
|
|
||||||
|
Here are some supplied functions that will produce a coordination using a particular scheduler.
|
||||||
|
|
||||||
|
* ```identity_immediate()```
|
||||||
|
* ```identity_current_thread()```
|
||||||
|
* ```identity_same_worker(worker w)```
|
||||||
|
* ```serialize_event_loop()```
|
||||||
|
* ```serialize_new_thread()```
|
||||||
|
* ```serialize_same_worker(worker w)```
|
||||||
|
* ```observe_on_event_loop()```
|
||||||
|
* ```observe_on_new_thread()```
|
||||||
|
|
||||||
|
There is no thread-pool scheduler yet. A thread-pool scheduler requires taking a dependency on a thread-pool implementation since I do not wish to write a thread-pool. My plan is to make a scheduler for the windows thread-pool and the apple thread-pool and the boost asio executor pool.. One question to answer is whether these platform specific constructs should live in the rxcpp repo or have platform specific repos.
|
114
3party/rxcpp/Ix/CPP/.gitignore
vendored
Normal file
114
3party/rxcpp/Ix/CPP/.gitignore
vendored
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
# Custom
|
||||||
|
*.vtg
|
||||||
|
*.vpwhist
|
||||||
|
|
||||||
|
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
|
||||||
|
# mstest test results
|
||||||
|
TestResults
|
||||||
|
|
||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Rr]elease/
|
||||||
|
x64/
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
*.ncrunch*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.Publish.xml
|
||||||
|
|
||||||
|
# NuGet Packages Directory
|
||||||
|
packages
|
||||||
|
|
||||||
|
# Windows Azure Build Output
|
||||||
|
csx
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Others
|
||||||
|
[Bb]in
|
||||||
|
[Oo]bj
|
||||||
|
sql
|
||||||
|
TestResults
|
||||||
|
[Tt]est[Rr]esult*
|
||||||
|
*.Cache
|
||||||
|
ClientBin
|
||||||
|
[Ss]tyle[Cc]op.*
|
||||||
|
~$*
|
||||||
|
*.dbmdl
|
||||||
|
Generated_Code #added for RIA/Silverlight projects
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file to a newer
|
||||||
|
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
|
||||||
|
# Mac crap
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
a.out
|
15
3party/rxcpp/Ix/CPP/license.txt
Normal file
15
3party/rxcpp/Ix/CPP/license.txt
Normal file
@ -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.
|
156
3party/rxcpp/Ix/CPP/projects/CppLinq.vpj
Normal file
156
3party/rxcpp/Ix/CPP/projects/CppLinq.vpj
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">
|
||||||
|
<Project
|
||||||
|
Version="10.0"
|
||||||
|
VendorName="SlickEdit"
|
||||||
|
WorkingDir=".">
|
||||||
|
<Config
|
||||||
|
Name="Release"
|
||||||
|
OutputFile=""
|
||||||
|
CompilerConfigName="Default Compiler"
|
||||||
|
ObjectDir="Release">
|
||||||
|
<Menu>
|
||||||
|
<Target
|
||||||
|
Name="Compile"
|
||||||
|
MenuCaption="&Compile"
|
||||||
|
CaptureOutputWith="ProcessBuffer"
|
||||||
|
SaveOption="SaveCurrent"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Exec/>
|
||||||
|
</Target>
|
||||||
|
<Target
|
||||||
|
Name="Build"
|
||||||
|
MenuCaption="&Build"
|
||||||
|
CaptureOutputWith="ProcessBuffer"
|
||||||
|
SaveOption="SaveWorkspaceFiles"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Set
|
||||||
|
Name="OutDir"
|
||||||
|
Value="%rw\%bn"/>
|
||||||
|
<Exec CmdLine="nmake O=%bn runtests"/>
|
||||||
|
</Target>
|
||||||
|
<Target
|
||||||
|
Name="Rebuild"
|
||||||
|
MenuCaption="&Rebuild"
|
||||||
|
CaptureOutputWith="ProcessBuffer"
|
||||||
|
SaveOption="SaveWorkspaceFiles"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Exec CmdLine="nmake O=%bn clean all"/>
|
||||||
|
</Target>
|
||||||
|
<Target
|
||||||
|
Name="Debug"
|
||||||
|
MenuCaption="&Debug"
|
||||||
|
SaveOption="SaveNone"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Exec/>
|
||||||
|
</Target>
|
||||||
|
<Target
|
||||||
|
Name="Execute"
|
||||||
|
MenuCaption="E&xecute"
|
||||||
|
SaveOption="SaveNone"
|
||||||
|
RunFromDir="%rw"
|
||||||
|
BuildFirst="1"
|
||||||
|
CaptureOutputWith="ProcessBuffer"
|
||||||
|
ClearProcessBuffer="1">
|
||||||
|
<Exec CmdLine='"%bn\testbench.exe"'/>
|
||||||
|
</Target>
|
||||||
|
</Menu>
|
||||||
|
<Includes>
|
||||||
|
</Includes>
|
||||||
|
</Config>
|
||||||
|
<Config
|
||||||
|
Name="Debug"
|
||||||
|
OutputFile=""
|
||||||
|
CompilerConfigName="Default Compiler"
|
||||||
|
ObjectDir="Debug">
|
||||||
|
<Menu>
|
||||||
|
<Target
|
||||||
|
Name="Compile"
|
||||||
|
MenuCaption="&Compile"
|
||||||
|
CaptureOutputWith="ProcessBuffer"
|
||||||
|
SaveOption="SaveCurrent"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Exec/>
|
||||||
|
</Target>
|
||||||
|
<Target
|
||||||
|
Name="Build"
|
||||||
|
MenuCaption="&Build"
|
||||||
|
CaptureOutputWith="ProcessBuffer"
|
||||||
|
SaveOption="SaveWorkspaceFiles"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Set
|
||||||
|
Name="OutDir"
|
||||||
|
Value="%rw\%bn"/>
|
||||||
|
<Exec CmdLine="nmake O=%bn runtests"/>
|
||||||
|
</Target>
|
||||||
|
<Target
|
||||||
|
Name="Rebuild"
|
||||||
|
MenuCaption="&Rebuild"
|
||||||
|
CaptureOutputWith="ProcessBuffer"
|
||||||
|
SaveOption="SaveWorkspaceFiles"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Exec CmdLine="nmake O=%bn clean all"/>
|
||||||
|
</Target>
|
||||||
|
<Target
|
||||||
|
Name="Debug"
|
||||||
|
MenuCaption="&Debug"
|
||||||
|
SaveOption="SaveNone"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Exec/>
|
||||||
|
</Target>
|
||||||
|
<Target
|
||||||
|
Name="Execute"
|
||||||
|
MenuCaption="E&xecute"
|
||||||
|
SaveOption="SaveNone"
|
||||||
|
RunFromDir="%rw"
|
||||||
|
BuildFirst="1"
|
||||||
|
CaptureOutputWith="ProcessBuffer"
|
||||||
|
ClearProcessBuffer="1">
|
||||||
|
<Exec CmdLine='"%bn\testbench.exe"'/>
|
||||||
|
</Target>
|
||||||
|
</Menu>
|
||||||
|
<Includes>
|
||||||
|
</Includes>
|
||||||
|
</Config>
|
||||||
|
<CustomFolders>
|
||||||
|
<Folder
|
||||||
|
Name="Source Files"
|
||||||
|
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d">
|
||||||
|
</Folder>
|
||||||
|
<Folder
|
||||||
|
Name="Header Files"
|
||||||
|
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
|
||||||
|
</Folder>
|
||||||
|
<Folder
|
||||||
|
Name="Resource Files"
|
||||||
|
Filters="*.ico;*.cur;*.dlg"/>
|
||||||
|
<Folder
|
||||||
|
Name="Bitmaps"
|
||||||
|
Filters="*.bmp"/>
|
||||||
|
<Folder
|
||||||
|
Name="Other Files"
|
||||||
|
Filters="">
|
||||||
|
</Folder>
|
||||||
|
</CustomFolders>
|
||||||
|
<Files AutoFolders="PackageView">
|
||||||
|
<F
|
||||||
|
N="*.cpp"
|
||||||
|
Recurse="1"
|
||||||
|
Refilter="0"
|
||||||
|
Excludes=""/>
|
||||||
|
<F
|
||||||
|
N="*.h"
|
||||||
|
Recurse="1"
|
||||||
|
Refilter="0"
|
||||||
|
Excludes=""/>
|
||||||
|
<F
|
||||||
|
N="*.hpp"
|
||||||
|
Recurse="1"
|
||||||
|
Refilter="0"
|
||||||
|
Excludes=""/>
|
||||||
|
<F
|
||||||
|
N="*.inl"
|
||||||
|
Recurse="1"
|
||||||
|
Refilter="0"
|
||||||
|
Excludes=""/>
|
||||||
|
</Files>
|
||||||
|
</Project>
|
7
3party/rxcpp/Ix/CPP/projects/CppLinq.vpw
Normal file
7
3party/rxcpp/Ix/CPP/projects/CppLinq.vpw
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<!DOCTYPE Workspace SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpw.dtd">
|
||||||
|
<Workspace Version="10.0" VendorName="SlickEdit">
|
||||||
|
<Projects>
|
||||||
|
<Project File="cpplinq/CppLinq.vpj"/>
|
||||||
|
<Project File="unittest/Unittest.CppLinq.vpj"/>
|
||||||
|
</Projects>
|
||||||
|
</Workspace>
|
137
3party/rxcpp/Ix/CPP/projects/Unittest.CppLinq.vpj
Normal file
137
3party/rxcpp/Ix/CPP/projects/Unittest.CppLinq.vpj
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">
|
||||||
|
<Project
|
||||||
|
Version="10.0"
|
||||||
|
VendorName="SlickEdit"
|
||||||
|
TemplateName="(Other)"
|
||||||
|
WorkingDir=".">
|
||||||
|
<Config
|
||||||
|
Name="Release"
|
||||||
|
OutputFile=""
|
||||||
|
CompilerConfigName="">
|
||||||
|
<Menu>
|
||||||
|
<Target
|
||||||
|
Name="Compile"
|
||||||
|
MenuCaption="&Compile"
|
||||||
|
CaptureOutputWith="ProcessBuffer"
|
||||||
|
SaveOption="SaveCurrent"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Exec/>
|
||||||
|
</Target>
|
||||||
|
<Target
|
||||||
|
Name="Build"
|
||||||
|
MenuCaption="&Build"
|
||||||
|
CaptureOutputWith="ProcessBuffer"
|
||||||
|
SaveOption="SaveWorkspaceFiles"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Exec CmdLine="nmake Config=%bn runtests"/>
|
||||||
|
</Target>
|
||||||
|
<Target
|
||||||
|
Name="Rebuild"
|
||||||
|
MenuCaption="&Rebuild"
|
||||||
|
CaptureOutputWith="ProcessBuffer"
|
||||||
|
SaveOption="SaveWorkspaceFiles"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Exec CmdLine="nmake Config=%bn clean all"/>
|
||||||
|
</Target>
|
||||||
|
<Target
|
||||||
|
Name="Debug"
|
||||||
|
MenuCaption="&Debug"
|
||||||
|
SaveOption="SaveNone"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Exec/>
|
||||||
|
</Target>
|
||||||
|
<Target
|
||||||
|
Name="Execute"
|
||||||
|
MenuCaption="E&xecute"
|
||||||
|
SaveOption="SaveNone"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Exec CmdLine='".exe"'/>
|
||||||
|
</Target>
|
||||||
|
</Menu>
|
||||||
|
</Config>
|
||||||
|
<Config
|
||||||
|
Name="Debug"
|
||||||
|
OutputFile=""
|
||||||
|
CompilerConfigName="">
|
||||||
|
<Menu>
|
||||||
|
<Target
|
||||||
|
Name="Compile"
|
||||||
|
MenuCaption="&Compile"
|
||||||
|
CaptureOutputWith="ProcessBuffer"
|
||||||
|
SaveOption="SaveCurrent"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Exec/>
|
||||||
|
</Target>
|
||||||
|
<Target
|
||||||
|
Name="Build"
|
||||||
|
MenuCaption="&Build"
|
||||||
|
CaptureOutputWith="ProcessBuffer"
|
||||||
|
SaveOption="SaveWorkspaceFiles"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Exec CmdLine="nmake Config=%bn runtests"/>
|
||||||
|
</Target>
|
||||||
|
<Target
|
||||||
|
Name="Rebuild"
|
||||||
|
MenuCaption="&Rebuild"
|
||||||
|
CaptureOutputWith="ProcessBuffer"
|
||||||
|
SaveOption="SaveWorkspaceFiles"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Exec CmdLine="nmake Config=%bn clean all"/>
|
||||||
|
</Target>
|
||||||
|
<Target
|
||||||
|
Name="Debug"
|
||||||
|
MenuCaption="&Debug"
|
||||||
|
SaveOption="SaveNone"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Exec/>
|
||||||
|
</Target>
|
||||||
|
<Target
|
||||||
|
Name="Execute"
|
||||||
|
MenuCaption="E&xecute"
|
||||||
|
SaveOption="SaveNone"
|
||||||
|
RunFromDir="%rw">
|
||||||
|
<Exec CmdLine='".exe"'/>
|
||||||
|
</Target>
|
||||||
|
</Menu>
|
||||||
|
</Config>
|
||||||
|
<CustomFolders>
|
||||||
|
<Folder
|
||||||
|
Name="Source Files"
|
||||||
|
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d">
|
||||||
|
</Folder>
|
||||||
|
<Folder
|
||||||
|
Name="Header Files"
|
||||||
|
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
|
||||||
|
</Folder>
|
||||||
|
<Folder
|
||||||
|
Name="Resource Files"
|
||||||
|
Filters="*.ico;*.cur;*.dlg"/>
|
||||||
|
<Folder
|
||||||
|
Name="Bitmaps"
|
||||||
|
Filters="*.bmp"/>
|
||||||
|
<Folder
|
||||||
|
Name="Other Files"
|
||||||
|
Filters="">
|
||||||
|
</Folder>
|
||||||
|
</CustomFolders>
|
||||||
|
<Files AutoFolders="PackageView">
|
||||||
|
<F
|
||||||
|
N="*.cpp"
|
||||||
|
Recurse="1"
|
||||||
|
Refilter="0"
|
||||||
|
Excludes=""/>
|
||||||
|
<F
|
||||||
|
N="*.h"
|
||||||
|
Recurse="1"
|
||||||
|
Refilter="0"
|
||||||
|
Excludes=""/>
|
||||||
|
<F
|
||||||
|
N="*.hpp"
|
||||||
|
Recurse="1"
|
||||||
|
Refilter="0"
|
||||||
|
Excludes=""/>
|
||||||
|
<F
|
||||||
|
N="makefile"
|
||||||
|
Type="Makefile"/>
|
||||||
|
</Files>
|
||||||
|
</Project>
|
128
3party/rxcpp/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.cpp
Normal file
128
3party/rxcpp/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.cpp
Normal file
@ -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 <cpplinq/linq.hpp>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <exception>
|
||||||
|
#include <regex>
|
||||||
|
#include <cmath>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <numeric>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
vector<string> load_data();
|
||||||
|
string extract_value(const string& input, const string& key);
|
||||||
|
|
||||||
|
|
||||||
|
void run()
|
||||||
|
{
|
||||||
|
using namespace cpplinq;
|
||||||
|
|
||||||
|
struct item {
|
||||||
|
string args;
|
||||||
|
int concurrency;
|
||||||
|
double time;
|
||||||
|
|
||||||
|
item(const string& input) {
|
||||||
|
args = extract_value(input, "args");
|
||||||
|
concurrency = atoi( extract_value(input, "concurrency").c_str() );
|
||||||
|
time = atof( extract_value(input, "time").c_str() );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
auto data_unparsed = load_data();
|
||||||
|
auto data_parsed =
|
||||||
|
from(data_unparsed)
|
||||||
|
.select([](const string& line) { return item(line); })
|
||||||
|
.to_vector();
|
||||||
|
|
||||||
|
cout << "data loaded" << endl;
|
||||||
|
|
||||||
|
auto data =
|
||||||
|
from(data_parsed)
|
||||||
|
.groupby([](const item& i) { return i.args; });
|
||||||
|
|
||||||
|
for (auto giter = data.begin(), end = data.end(); giter != end; ++giter)
|
||||||
|
{
|
||||||
|
const auto& g = *giter;
|
||||||
|
|
||||||
|
cout << "arguments: " << g.key << endl;
|
||||||
|
|
||||||
|
cout << "concurrency, mean, |, raw_data," << endl;
|
||||||
|
auto seq =
|
||||||
|
from(g)
|
||||||
|
.groupby([](const item& i) { return i.concurrency; });
|
||||||
|
|
||||||
|
for (auto giter = seq.begin(), end = seq.end(); giter != end; ++giter)
|
||||||
|
{
|
||||||
|
const auto& g = *giter;
|
||||||
|
|
||||||
|
cout << g.key << ", ";
|
||||||
|
|
||||||
|
auto times = from(g).select([](const item& i) { return i.time; });
|
||||||
|
|
||||||
|
auto n = from(g).count();
|
||||||
|
auto sum = std::accumulate(times.begin(), times.end(), 0.0);
|
||||||
|
|
||||||
|
cout << (sum / n) << ", |";
|
||||||
|
|
||||||
|
for (auto timeIter = times.begin(), end = times.end();
|
||||||
|
timeIter != end;
|
||||||
|
++timeIter)
|
||||||
|
{
|
||||||
|
cout << ", " << *timeIter;
|
||||||
|
}
|
||||||
|
cout << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
run();
|
||||||
|
} catch (exception& e) {
|
||||||
|
cerr << "exception: " << e.what() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<string> load_data()
|
||||||
|
{
|
||||||
|
ifstream datafile("data.txt");
|
||||||
|
vector<string> v;
|
||||||
|
string line;
|
||||||
|
|
||||||
|
if (datafile.fail())
|
||||||
|
throw logic_error("could not find file");
|
||||||
|
|
||||||
|
while(getline(datafile, line))
|
||||||
|
v.push_back(line);
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
regex key_value_pair("'([^\']*)'\\s*[:,]\\s*(\\d+(?:\\.\\d+)?|'[^']*')");
|
||||||
|
|
||||||
|
string extract_value(const string& input, const string& key)
|
||||||
|
{
|
||||||
|
const std::sregex_iterator end;
|
||||||
|
for (std::sregex_iterator i(input.cbegin(), input.cend(), key_value_pair);
|
||||||
|
i != end;
|
||||||
|
++i)
|
||||||
|
{
|
||||||
|
if ((*i)[1] == key)
|
||||||
|
{
|
||||||
|
return (*i)[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw std::range_error("search key not found");
|
||||||
|
}
|
655
3party/rxcpp/Ix/CPP/samples/SampleCppLinq/data.txt
Normal file
655
3party/rxcpp/Ix/CPP/samples/SampleCppLinq/data.txt
Normal file
@ -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}}
|
584
3party/rxcpp/Ix/CPP/src/cpplinq/linq.hpp
Normal file
584
3party/rxcpp/Ix/CPP/src/cpplinq/linq.hpp
Normal file
@ -0,0 +1,584 @@
|
|||||||
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
///
|
||||||
|
/// namespace cpplinq
|
||||||
|
/// -----------------
|
||||||
|
///
|
||||||
|
/// Defines a number of range-based composable operators for enumerating and modifying collections
|
||||||
|
///
|
||||||
|
/// The general design philosophy is to
|
||||||
|
/// (1) emulate the composable query patterns introduced in C# Linq
|
||||||
|
/// (2) preserve iterator category and writability where possible
|
||||||
|
/// For instance, like C# Linq we have a select operator to project one sequence into a new one.
|
||||||
|
/// Unlike Linq, invoking Select on a random access sequence will yield you a _random_ access sequence.
|
||||||
|
///
|
||||||
|
/// The general workflow begins with 'from()' which normally only takes a reference
|
||||||
|
/// the the collection in question. However, from that point on, all operators function
|
||||||
|
/// by value, so that the range can store any necessary state, rather than duplicating it
|
||||||
|
/// onto iterator pairs.
|
||||||
|
///
|
||||||
|
/// In subsequent documentation, "powers" lists which powers that the operator attempts to preserve if
|
||||||
|
/// available on on the input sequence. Some iterator powers may be skipped - in such a case, round down
|
||||||
|
/// to the next supported power (e.g. if 'fwd' and 'rnd', an input of 'bidi' will round down to a 'fwd' result).
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// class linq_query
|
||||||
|
/// ----------------
|
||||||
|
///
|
||||||
|
/// from(container&)
|
||||||
|
/// ================
|
||||||
|
/// - Result: Query
|
||||||
|
///
|
||||||
|
/// Construct a new query, from an lvalue reference to a collection. Does not copy the collection
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// from(iter, iter)
|
||||||
|
/// ================
|
||||||
|
/// - Result: Query
|
||||||
|
///
|
||||||
|
/// Construct a new query, from an iterator pair.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// query.select(map)
|
||||||
|
/// ==========================
|
||||||
|
/// - Result: Query
|
||||||
|
/// - Powers: input, forward, bidirectional, random access
|
||||||
|
///
|
||||||
|
/// For each element `x` in the input sequences, computes `map(x)` for the result sequence.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// query.where(pred) -> query
|
||||||
|
/// ==========================
|
||||||
|
/// - Result: Query
|
||||||
|
/// - Powers: input, forward, bidirectional
|
||||||
|
///
|
||||||
|
/// Each element `x` in the input appears in the output if `pred(x)` is true.
|
||||||
|
///
|
||||||
|
/// The expression `pred(x)` is evaluated only when moving iterators (op++, op--).
|
||||||
|
/// Dereferencing (op*) does not invoke the predicate.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// query.groupby(keymap [, keyequal])
|
||||||
|
/// ====================================
|
||||||
|
/// Result: Query of groups. Each group has a 'key' field, and is a query of elements from the input.
|
||||||
|
/// Powers: forward
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// query.any([pred])
|
||||||
|
/// =================
|
||||||
|
/// - Result: bool
|
||||||
|
///
|
||||||
|
/// (No argument) Returns true if sequence is non-empty. Equivalent to `query.begin()!=query.end()`
|
||||||
|
///
|
||||||
|
/// (One argument) Returns true if the sequence contains any elements for which `pred(element)` is true.
|
||||||
|
/// Equivalent to `query.where(pred).any()`.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// query.all(pred)
|
||||||
|
/// ===============
|
||||||
|
/// - Result: bool
|
||||||
|
///
|
||||||
|
/// Returns true if `pred` holds for all elements in the sequence. Equivalent to `!query.any(std::not1(pred))`
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// query.take(n)
|
||||||
|
/// =============
|
||||||
|
/// - Result: query
|
||||||
|
/// - Powers: input, forward, random access (not bidirectional)
|
||||||
|
///
|
||||||
|
/// Returns a sequence that contains up to `n` items from the original sequence.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// query.skip(n)
|
||||||
|
/// =============
|
||||||
|
/// - Result: query
|
||||||
|
/// - Powers: input, forward, random access (not bidirectional)
|
||||||
|
///
|
||||||
|
/// Returns a sequence that skips the first `n` items from the original sequence, or an empty sequence if
|
||||||
|
/// fewer than `n` were available on input.
|
||||||
|
///
|
||||||
|
/// Note: begin() takes O(n) time when input iteration power is weaker than random access.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// query.count([pred])
|
||||||
|
/// ===================
|
||||||
|
/// - Result: std::size_t
|
||||||
|
///
|
||||||
|
/// _TODO: should use inner container's iterator distance type instead._
|
||||||
|
///
|
||||||
|
/// (Zero-argument) Returns the number of elements in the range.
|
||||||
|
/// Equivalent to `std::distance(query.begin(), query.end())`
|
||||||
|
///
|
||||||
|
/// (One-argument) Returns the number of elements for whicht `pred(element)` is true.
|
||||||
|
/// Equivalent to `query.where(pred).count()`
|
||||||
|
///
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(CPPLINQ_LINQ_HPP)
|
||||||
|
#define CPPLINQ_LINQ_HPP
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#pragma push_macro("min")
|
||||||
|
#pragma push_macro("max")
|
||||||
|
#undef min
|
||||||
|
#undef max
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <iterator>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <numeric>
|
||||||
|
#include <list>
|
||||||
|
#include <map>
|
||||||
|
#include <set>
|
||||||
|
#include <memory>
|
||||||
|
#include <utility>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <vector>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// some configuration macros
|
||||||
|
#if _MSC_VER > 1600 || __cplusplus > 199711L
|
||||||
|
#define LINQ_USE_RVALUEREF 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (defined(_MSC_VER) && _CPPRTTI) || !defined(_MSC_VER)
|
||||||
|
#define LINQ_USE_RTTI 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
#if __has_feature(cxx_rvalue_references)
|
||||||
|
#define LINQ_USE_RVALUEREF 1
|
||||||
|
#endif
|
||||||
|
#if __has_feature(cxx_rtti)
|
||||||
|
#define LINQ_USE_RTTI 1
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// individual features
|
||||||
|
#include "util.hpp"
|
||||||
|
#include "linq_cursor.hpp"
|
||||||
|
#include "linq_iterators.hpp"
|
||||||
|
#include "linq_select.hpp"
|
||||||
|
#include "linq_take.hpp"
|
||||||
|
#include "linq_skip.hpp"
|
||||||
|
#include "linq_groupby.hpp"
|
||||||
|
#include "linq_where.hpp"
|
||||||
|
#include "linq_last.hpp"
|
||||||
|
#include "linq_selectmany.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace cpplinq
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template<class Pred>
|
||||||
|
struct not1_{
|
||||||
|
Pred pred;
|
||||||
|
not1_(Pred p) : pred(p)
|
||||||
|
{}
|
||||||
|
template<class T>
|
||||||
|
bool operator()(const T& value)
|
||||||
|
{
|
||||||
|
return !pred(value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// note: VC2010's std::not1 doesn't support lambda expressions. provide our own.
|
||||||
|
template<class Pred>
|
||||||
|
not1_<Pred> not1(Pred p) { return not1_<Pred>(p); }
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
template <class U>
|
||||||
|
struct cast_to {
|
||||||
|
template <class T>
|
||||||
|
U operator()(const T& value) const {
|
||||||
|
return static_cast<U>(value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Collection>
|
||||||
|
class linq_driver
|
||||||
|
{
|
||||||
|
typedef typename Collection::cursor::element_type
|
||||||
|
element_type;
|
||||||
|
typedef typename Collection::cursor::reference_type
|
||||||
|
reference_type;
|
||||||
|
public:
|
||||||
|
typedef cursor_iterator<typename Collection::cursor>
|
||||||
|
iterator;
|
||||||
|
|
||||||
|
linq_driver(Collection c) : c(c) {}
|
||||||
|
|
||||||
|
|
||||||
|
// -------------------- linq core methods --------------------
|
||||||
|
|
||||||
|
template <class KeyFn>
|
||||||
|
linq_driver< linq_groupby<Collection, KeyFn> > groupby(KeyFn fn)
|
||||||
|
{
|
||||||
|
return linq_groupby<Collection, KeyFn>(c, std::move(fn) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: groupby(keyfn, eq)
|
||||||
|
|
||||||
|
// TODO: join...
|
||||||
|
|
||||||
|
template <class Selector>
|
||||||
|
linq_driver< linq_select<Collection, Selector> > select(Selector sel) const {
|
||||||
|
return linq_select<Collection, Selector>(c, std::move(sel) );
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Fn>
|
||||||
|
linq_driver< linq_select_many<Collection, Fn, detail::default_select_many_selector> >
|
||||||
|
select_many(Fn fn) const
|
||||||
|
{
|
||||||
|
return linq_select_many<Collection, Fn, detail::default_select_many_selector>(c, fn, detail::default_select_many_selector());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Fn, class Fn2>
|
||||||
|
linq_driver< linq_select_many<Collection, Fn, Fn2> > select_many(Fn fn, Fn2 fn2) const
|
||||||
|
{
|
||||||
|
return linq_select_many<Collection, Fn, Fn2>(c, fn, fn2);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Predicate>
|
||||||
|
linq_driver< linq_where<Collection, Predicate> > where(Predicate p) const {
|
||||||
|
return linq_where<Collection, Predicate>(c, std::move(p) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -------------------- linq peripheral methods --------------------
|
||||||
|
|
||||||
|
template <class Fn>
|
||||||
|
element_type aggregate(Fn fn) const
|
||||||
|
{
|
||||||
|
auto it = begin();
|
||||||
|
if (it == end()) {
|
||||||
|
return element_type();
|
||||||
|
}
|
||||||
|
|
||||||
|
reference_type first = *it;
|
||||||
|
return std::accumulate(++it, end(), first, fn);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T, class Fn>
|
||||||
|
T aggregate(T initialValue, Fn fn) const
|
||||||
|
{
|
||||||
|
return std::accumulate(begin(), end(), initialValue, fn);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool any() const { auto cur = c.get_cursor(); return !cur.empty(); }
|
||||||
|
|
||||||
|
template <class Predicate>
|
||||||
|
bool any(Predicate p) const {
|
||||||
|
auto it = std::find_if(begin(), end(), p);
|
||||||
|
return it != end();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Predicate>
|
||||||
|
bool all(Predicate p) const {
|
||||||
|
auto it = std::find_if(begin(), end(), detail::not1(p));
|
||||||
|
return it == end();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: average
|
||||||
|
|
||||||
|
#if !defined(__clang__)
|
||||||
|
// Clang complains that linq_driver is not complete until the closing brace
|
||||||
|
// so (linq_driver*)->select() cannot be resolved.
|
||||||
|
template <class U>
|
||||||
|
auto cast()
|
||||||
|
-> decltype(static_cast<linq_driver*>(0)->select(detail::cast_to<U>()))
|
||||||
|
{
|
||||||
|
return this->select(detail::cast_to<U>());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// TODO: concat
|
||||||
|
|
||||||
|
bool contains(const typename Collection::cursor::element_type& value) const {
|
||||||
|
return std::find(begin(), end(), value) != end();
|
||||||
|
}
|
||||||
|
|
||||||
|
typename std::iterator_traits<iterator>::difference_type count() const {
|
||||||
|
return std::distance(begin(), end());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Predicate>
|
||||||
|
typename std::iterator_traits<iterator>::difference_type count(Predicate p) const {
|
||||||
|
auto filtered = this->where(p);
|
||||||
|
return std::distance(begin(filtered), end(filtered));
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: default_if_empty
|
||||||
|
|
||||||
|
// TODO: distinct()
|
||||||
|
// TODO: distinct(cmp)
|
||||||
|
|
||||||
|
reference_type element_at(std::size_t ix) const {
|
||||||
|
auto cur = c.get_cursor();
|
||||||
|
while(ix && !cur.empty()) {
|
||||||
|
cur.inc();
|
||||||
|
--ix;
|
||||||
|
}
|
||||||
|
if (cur.empty()) { throw std::logic_error("index out of bounds"); }
|
||||||
|
else { return cur.get(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
element_type element_at_or_default(std::size_t ix) const {
|
||||||
|
auto cur = c.get_cursor();
|
||||||
|
while(ix && !cur.empty()) {
|
||||||
|
cur.inc();
|
||||||
|
-- ix;
|
||||||
|
}
|
||||||
|
if (cur.empty()) { return element_type(); }
|
||||||
|
else { return cur.get(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
bool empty() const {
|
||||||
|
return !this->any();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: except(second)
|
||||||
|
// TODO: except(second, eq)
|
||||||
|
|
||||||
|
reference_type first() const {
|
||||||
|
auto cur = c.get_cursor();
|
||||||
|
if (cur.empty()) { throw std::logic_error("index out of bounds"); }
|
||||||
|
else { return cur.get(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Predicate>
|
||||||
|
reference_type first(Predicate pred) const {
|
||||||
|
auto cur = c.get_cursor();
|
||||||
|
while (!cur.empty() && !pred(cur.get())) {
|
||||||
|
cur.inc();
|
||||||
|
}
|
||||||
|
if (cur.empty()) { throw std::logic_error("index out of bounds"); }
|
||||||
|
else { return cur.get(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
element_type first_or_default() const {
|
||||||
|
auto cur = c.get_cursor();
|
||||||
|
if (cur.empty()) { return element_type(); }
|
||||||
|
else { return cur.get(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Predicate>
|
||||||
|
element_type first_or_default(Predicate pred) const {
|
||||||
|
auto cur = c.get_cursor();
|
||||||
|
while (!cur.empty() && !pred(cur.get())) {
|
||||||
|
cur.inc();
|
||||||
|
}
|
||||||
|
if (cur.empty()) { return element_type(); }
|
||||||
|
else { return cur.get(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: intersect(second)
|
||||||
|
// TODO: intersect(second, eq)
|
||||||
|
|
||||||
|
// note: forward cursors and beyond can provide a clone, so we can refer to the element directly
|
||||||
|
typename std::conditional<
|
||||||
|
std::is_convertible<
|
||||||
|
typename Collection::cursor::cursor_category,
|
||||||
|
forward_cursor_tag>::value,
|
||||||
|
reference_type,
|
||||||
|
element_type>::type
|
||||||
|
last() const
|
||||||
|
{
|
||||||
|
return linq_last_(c.get_cursor(), typename Collection::cursor::cursor_category());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Predicate>
|
||||||
|
reference_type last(Predicate pred) const
|
||||||
|
{
|
||||||
|
auto cur = c.where(pred).get_cursor();
|
||||||
|
return linq_last_(cur, typename decltype(cur)::cursor_category());
|
||||||
|
}
|
||||||
|
|
||||||
|
element_type last_or_default() const
|
||||||
|
{
|
||||||
|
return linq_last_or_default_(c.get_cursor(), typename Collection::cursor::cursor_category());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Predicate>
|
||||||
|
element_type last_or_default(Predicate pred) const
|
||||||
|
{
|
||||||
|
auto cur = c.where(pred).get_cursor();
|
||||||
|
return linq_last_or_default_(cur, typename decltype(cur)::cursor_category());
|
||||||
|
}
|
||||||
|
|
||||||
|
reference_type max() const
|
||||||
|
{
|
||||||
|
return max(std::less<element_type>());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Compare>
|
||||||
|
reference_type max(Compare less) const
|
||||||
|
{
|
||||||
|
auto it = std::max_element(begin(), end(), less);
|
||||||
|
if (it == end())
|
||||||
|
throw std::logic_error("max performed on empty range");
|
||||||
|
|
||||||
|
return *it;
|
||||||
|
}
|
||||||
|
|
||||||
|
reference_type min() const
|
||||||
|
{
|
||||||
|
return min(std::less<element_type>());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Compare>
|
||||||
|
reference_type min(Compare less) const
|
||||||
|
{
|
||||||
|
auto it = std::min_element(begin(), end(), less);
|
||||||
|
if (it == end())
|
||||||
|
throw std::logic_error("max performed on empty range");
|
||||||
|
|
||||||
|
return *it;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: order_by(sel)
|
||||||
|
// TODO: order_by(sel, less)
|
||||||
|
// TODO: order_by_descending(sel)
|
||||||
|
// TODO: order_by_descending(sel, less)
|
||||||
|
|
||||||
|
// TODO: sequence_equal(second)
|
||||||
|
// TODO: sequence_equal(second, eq)
|
||||||
|
|
||||||
|
// TODO: single / single_or_default
|
||||||
|
|
||||||
|
linq_driver<linq_skip<Collection>> skip(std::size_t n) const {
|
||||||
|
return linq_skip<Collection>(c, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: skip_while(pred)
|
||||||
|
|
||||||
|
template<typename ITEM = element_type>
|
||||||
|
typename std::enable_if<std::is_default_constructible<ITEM>::value, ITEM>::type sum() const {
|
||||||
|
ITEM seed{};
|
||||||
|
return sum(seed);
|
||||||
|
}
|
||||||
|
|
||||||
|
element_type sum(element_type seed) const {
|
||||||
|
return std::accumulate(begin(), end(), seed);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Selector, typename Result = typename std::result_of<Selector(element_type)>::type>
|
||||||
|
typename std::enable_if<std::is_default_constructible<Result>::value, Result>::type sum(Selector sel) const {
|
||||||
|
return from(begin(), end()).select(sel).sum();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Selector, typename Result = typename std::result_of<Selector(element_type)>::type>
|
||||||
|
Result sum(Selector sel, Result seed) const {
|
||||||
|
return from(begin(), end()).select(sel).sum(seed);
|
||||||
|
}
|
||||||
|
|
||||||
|
linq_driver<linq_take<Collection>> take(std::size_t n) const {
|
||||||
|
return linq_take<Collection>(c, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: take_while
|
||||||
|
|
||||||
|
// TODO: then_by / then_by_descending ?
|
||||||
|
|
||||||
|
// TODO: to_...
|
||||||
|
|
||||||
|
// TODO: union(second)
|
||||||
|
// TODO: union(eq)
|
||||||
|
|
||||||
|
// TODO: zip
|
||||||
|
|
||||||
|
// -------------------- conversion methods --------------------
|
||||||
|
|
||||||
|
std::vector<typename Collection::cursor::element_type> to_vector() const
|
||||||
|
{
|
||||||
|
return std::vector<typename Collection::cursor::element_type>(begin(), end());
|
||||||
|
}
|
||||||
|
|
||||||
|
std::list<typename Collection::cursor::element_type> to_list() const
|
||||||
|
{
|
||||||
|
return std::list<typename Collection::cursor::element_type>(begin(), end());
|
||||||
|
}
|
||||||
|
|
||||||
|
std::set<typename Collection::cursor::element_type> to_set() const
|
||||||
|
{
|
||||||
|
return std::set<typename Collection::cursor::element_type>(begin(), end());
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------- container/range methods --------------------
|
||||||
|
|
||||||
|
iterator begin() const { auto cur = c.get_cursor(); return !cur.empty() ? iterator(cur) : iterator(); }
|
||||||
|
iterator end() const { return iterator(); }
|
||||||
|
linq_driver& operator=(const linq_driver& other) { c = other.c; return *this; }
|
||||||
|
template <class TC2>
|
||||||
|
linq_driver& operator=(const linq_driver<TC2>& other) { c = other.c; return *this; }
|
||||||
|
|
||||||
|
typename std::iterator_traits<iterator>::reference
|
||||||
|
operator[](std::size_t ix) const {
|
||||||
|
return *(begin()+=ix);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------- collection methods (leaky abstraction) --------------------
|
||||||
|
|
||||||
|
typedef typename Collection::cursor cursor;
|
||||||
|
cursor get_cursor() { return c.get_cursor(); }
|
||||||
|
|
||||||
|
linq_driver< dynamic_collection<typename Collection::cursor::reference_type> >
|
||||||
|
late_bind() const
|
||||||
|
{
|
||||||
|
return dynamic_collection<typename Collection::cursor::reference_type>(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Collection c;
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO: should probably use reference-wrapper instead?
|
||||||
|
template <class TContainer>
|
||||||
|
linq_driver<iter_cursor<typename util::container_traits<TContainer>::iterator>> from(TContainer& c)
|
||||||
|
{
|
||||||
|
auto cur = iter_cursor<typename util::container_traits<TContainer>::iterator>(std::begin(c), std::end(c));
|
||||||
|
return cur;
|
||||||
|
}
|
||||||
|
template <class T>
|
||||||
|
const linq_driver<T>& from(const linq_driver<T>& c)
|
||||||
|
{
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
template <class Iter>
|
||||||
|
linq_driver<iter_cursor<Iter>> from(Iter start, Iter finish)
|
||||||
|
{
|
||||||
|
return iter_cursor<Iter>(start, finish);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class TContainer>
|
||||||
|
linq_driver<TContainer> from_value(const TContainer& c)
|
||||||
|
{
|
||||||
|
return linq_driver<TContainer>(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma pop_macro("min")
|
||||||
|
#pragma pop_macro("max")
|
||||||
|
|
||||||
|
#endif // defined(CPPLINQ_LINQ_HPP)
|
||||||
|
|
342
3party/rxcpp/Ix/CPP/src/cpplinq/linq_cursor.hpp
Normal file
342
3party/rxcpp/Ix/CPP/src/cpplinq/linq_cursor.hpp
Normal file
@ -0,0 +1,342 @@
|
|||||||
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#if !defined(CPPLINQ_LINQ_CURSOR_HPP)
|
||||||
|
#define CPPLINQ_LINQ_CURSOR_HPP
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
/// cursors
|
||||||
|
/// ----------
|
||||||
|
/// It should be noted that CppLinq uses a slightly different iterator concept, one where iterators
|
||||||
|
/// know their extents. This sacrificed some generality, but it adds convenience and improves
|
||||||
|
/// some performance in some cases. Notably, captures need only be stored once instead of twice in
|
||||||
|
/// most use cases.
|
||||||
|
///
|
||||||
|
/// Cursors and Ranges are always classes.
|
||||||
|
///
|
||||||
|
/// To get a cursor from a range:
|
||||||
|
///
|
||||||
|
/// get_cursor(range) -> cur
|
||||||
|
///
|
||||||
|
/// Unlike boost ranges, CppLinq cursors are mutated directly, and may "shed state" as they are
|
||||||
|
/// mutated. For example, a GroupBy range will drop references to earlier groups, possibly
|
||||||
|
/// permitting freeing them.
|
||||||
|
///
|
||||||
|
/// Onepass cursor
|
||||||
|
/// ===========
|
||||||
|
/// - empty(cur) -> bool : at end of sequence
|
||||||
|
/// - inc(cur)
|
||||||
|
/// - get(cur) -> T
|
||||||
|
/// - copy ctor : duplicate reference to seek position
|
||||||
|
///
|
||||||
|
/// Forward cursor
|
||||||
|
/// =============
|
||||||
|
/// - copy ctor : true duplicate of seek position
|
||||||
|
///
|
||||||
|
/// Bidirectional cursor
|
||||||
|
/// ====================
|
||||||
|
/// - forget() : notes the current element as the new 'begin' point
|
||||||
|
/// - atbegin(cur) -> bool
|
||||||
|
/// - dec(cur)
|
||||||
|
///
|
||||||
|
/// Random access cursor
|
||||||
|
/// ====================
|
||||||
|
/// - skip(cur, n)
|
||||||
|
/// - position(cur) -> n
|
||||||
|
/// - size(cur) -> n
|
||||||
|
/// - truncate(n) : keep only n more elements
|
||||||
|
///
|
||||||
|
/// As well, cursors must define the appropriate type/typedefs:
|
||||||
|
/// - cursor_category :: { onepass_cursor_tag, forward_cursor_tag, bidirectional_cursor_tag, random_access_cursor_tag }
|
||||||
|
/// - element_type
|
||||||
|
/// - reference_type : if writable, element_type& or such. else, == element_type
|
||||||
|
/// -
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace cpplinq {
|
||||||
|
|
||||||
|
// used to identify cursor-based collections
|
||||||
|
struct collection_tag {};
|
||||||
|
|
||||||
|
struct onepass_cursor_tag {};
|
||||||
|
struct forward_cursor_tag : onepass_cursor_tag {};
|
||||||
|
struct bidirectional_cursor_tag : forward_cursor_tag {};
|
||||||
|
struct random_access_cursor_tag : bidirectional_cursor_tag {};
|
||||||
|
|
||||||
|
struct noread_cursor_tag {}; // TODO: remove if not used
|
||||||
|
struct readonly_cursor_tag : noread_cursor_tag {};
|
||||||
|
struct readwrite_cursor_tag : readonly_cursor_tag {};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// standard cursor adaptors
|
||||||
|
|
||||||
|
namespace util
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template <std::size_t n> struct type_to_size { char value[n]; };
|
||||||
|
|
||||||
|
type_to_size<1> get_category_from_iterator(std::input_iterator_tag);
|
||||||
|
type_to_size<2> get_category_from_iterator(std::forward_iterator_tag);
|
||||||
|
type_to_size<3> get_category_from_iterator(std::bidirectional_iterator_tag);
|
||||||
|
type_to_size<4> get_category_from_iterator(std::random_access_iterator_tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <std::size_t>
|
||||||
|
struct iter_to_cursor_category_;
|
||||||
|
|
||||||
|
template <class Iter>
|
||||||
|
struct iter_to_cursor_category
|
||||||
|
{
|
||||||
|
static const std::size_t catIx = sizeof(detail::get_category_from_iterator(typename std::iterator_traits<Iter>::iterator_category()) /*.value*/ );
|
||||||
|
typedef typename iter_to_cursor_category_<catIx>::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> struct iter_to_cursor_category_<1> { typedef onepass_cursor_tag type; };
|
||||||
|
template <> struct iter_to_cursor_category_<2> { typedef forward_cursor_tag type; };
|
||||||
|
template <> struct iter_to_cursor_category_<3> { typedef bidirectional_cursor_tag type; };
|
||||||
|
template <> struct iter_to_cursor_category_<4> { typedef random_access_cursor_tag type; };
|
||||||
|
|
||||||
|
|
||||||
|
// Note: returns false if no partial order exists between two
|
||||||
|
// particular iterator categories, such as with some of the boost categories
|
||||||
|
template <class Cat1, class Cat2>
|
||||||
|
struct less_or_equal_cursor_category
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
typedef char yes;
|
||||||
|
typedef struct { char c1,c2; } no;
|
||||||
|
static yes invoke(Cat1);
|
||||||
|
static no invoke(...);
|
||||||
|
public:
|
||||||
|
enum { value = (sizeof(invoke(Cat2())) == sizeof(yes)) };
|
||||||
|
};
|
||||||
|
|
||||||
|
// Return the weaker of the two iterator categories. Make sure
|
||||||
|
// a non-standard category is in the second argument position, as
|
||||||
|
// this metafunction will default to the first value if the order is undefined
|
||||||
|
template <class Cat1, class Cat2, class Cat3 = void>
|
||||||
|
struct min_cursor_category : min_cursor_category<typename min_cursor_category<Cat1, Cat2>::type, Cat3>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class Cat1, class Cat2>
|
||||||
|
struct min_cursor_category<Cat1, Cat2>
|
||||||
|
: std::conditional<
|
||||||
|
less_or_equal_cursor_category<Cat2, Cat1>::value,
|
||||||
|
Cat2,
|
||||||
|
Cat1>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class Collection>
|
||||||
|
struct cursor_type {
|
||||||
|
typedef decltype(cursor(*static_cast<Collection*>(0))) type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// simultaniously models a cursor and a cursor-collection
|
||||||
|
template <class Iterator>
|
||||||
|
class iter_cursor : collection_tag {
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef iter_cursor cursor;
|
||||||
|
|
||||||
|
typedef typename std::remove_reference<typename std::iterator_traits<Iterator>::value_type>::type
|
||||||
|
element_type;
|
||||||
|
typedef typename std::iterator_traits<Iterator>::reference
|
||||||
|
reference_type;
|
||||||
|
typedef typename util::iter_to_cursor_category<Iterator>::type
|
||||||
|
cursor_category;
|
||||||
|
|
||||||
|
void forget() { start = current; }
|
||||||
|
bool empty() const { return current == fin; }
|
||||||
|
void inc() {
|
||||||
|
if (current == fin)
|
||||||
|
throw std::logic_error("inc past end");
|
||||||
|
++current;
|
||||||
|
}
|
||||||
|
typename std::iterator_traits<Iterator>::reference get() const { return *current; }
|
||||||
|
|
||||||
|
bool atbegin() const { return current == start; }
|
||||||
|
void dec() {
|
||||||
|
if (current == start)
|
||||||
|
throw std::logic_error("dec past begin");
|
||||||
|
--current;
|
||||||
|
}
|
||||||
|
|
||||||
|
void skip(std::ptrdiff_t n) { current += n; }
|
||||||
|
std::size_t size() { return fin-start; }
|
||||||
|
void position() { return current-start; }
|
||||||
|
void truncate(std::size_t n) {
|
||||||
|
if (n > fin-current) {
|
||||||
|
fin = current + n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
iter_cursor(Iterator start, Iterator fin)
|
||||||
|
: current(start)
|
||||||
|
, start(start)
|
||||||
|
, fin(std::move(fin))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
iter_cursor(Iterator start, Iterator fin, Iterator current)
|
||||||
|
: current(std::move(current))
|
||||||
|
, start(std::move(start))
|
||||||
|
, fin(std::move(fin))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
iter_cursor get_cursor() const { return *this; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
Iterator current;
|
||||||
|
Iterator start, fin;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct cursor_interface
|
||||||
|
{
|
||||||
|
virtual bool empty() const = 0;
|
||||||
|
virtual void inc() = 0;
|
||||||
|
virtual cursor_interface* copy() const = 0;
|
||||||
|
|
||||||
|
virtual T get() const = 0;
|
||||||
|
|
||||||
|
virtual ~cursor_interface() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class dynamic_cursor : collection_tag
|
||||||
|
{
|
||||||
|
template <class Cur>
|
||||||
|
struct instance : cursor_interface<T>
|
||||||
|
{
|
||||||
|
Cur innerCursor;
|
||||||
|
|
||||||
|
instance(Cur cursor) : innerCursor(std::move(cursor))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual bool empty() const
|
||||||
|
{
|
||||||
|
return innerCursor.empty();
|
||||||
|
}
|
||||||
|
virtual void inc()
|
||||||
|
{
|
||||||
|
innerCursor.inc();
|
||||||
|
}
|
||||||
|
virtual T get() const
|
||||||
|
{
|
||||||
|
return innerCursor.get();
|
||||||
|
}
|
||||||
|
virtual cursor_interface<T>* copy() const
|
||||||
|
{
|
||||||
|
return new instance(*this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
std::unique_ptr<cursor_interface<T>> myCur;
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef forward_cursor_tag cursor_category; // TODO: not strictly true!
|
||||||
|
typedef typename std::remove_reference<T>::type element_type;
|
||||||
|
typedef T reference_type;
|
||||||
|
|
||||||
|
dynamic_cursor() {}
|
||||||
|
|
||||||
|
dynamic_cursor(const dynamic_cursor& other)
|
||||||
|
: myCur(other.myCur ? other.myCur->copy() : nullptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic_cursor(dynamic_cursor&& other)
|
||||||
|
: myCur(other.myCur.release())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Cursor>
|
||||||
|
dynamic_cursor(Cursor cursor)
|
||||||
|
: myCur(new instance<Cursor>(std::move(cursor)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Iterator>
|
||||||
|
dynamic_cursor(Iterator start, Iterator end)
|
||||||
|
{
|
||||||
|
*this = iter_cursor<Iterator>(start, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool empty() const { return !myCur || myCur->empty(); }
|
||||||
|
void inc() { myCur->inc(); }
|
||||||
|
T get() const { return myCur->get(); }
|
||||||
|
|
||||||
|
dynamic_cursor& operator=(dynamic_cursor other)
|
||||||
|
{
|
||||||
|
std::swap(myCur, other.myCur);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct container_interface
|
||||||
|
{
|
||||||
|
virtual dynamic_cursor<T> get_cursor() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class dynamic_collection
|
||||||
|
{
|
||||||
|
std::shared_ptr< container_interface<T> > container;
|
||||||
|
|
||||||
|
template <class Container>
|
||||||
|
struct instance : container_interface<T>
|
||||||
|
{
|
||||||
|
Container c;
|
||||||
|
|
||||||
|
instance(Container c) : c(c)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic_cursor<T> get_cursor() const
|
||||||
|
{
|
||||||
|
return c.get_cursor();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef dynamic_cursor<T> cursor;
|
||||||
|
|
||||||
|
dynamic_collection() {}
|
||||||
|
|
||||||
|
dynamic_collection(const dynamic_collection& other)
|
||||||
|
: container(other.container)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// container or query
|
||||||
|
template <class Container>
|
||||||
|
dynamic_collection(Container c)
|
||||||
|
: container(new instance<Container>(c))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// container or query
|
||||||
|
template <class Iterator>
|
||||||
|
dynamic_collection(Iterator begin, Iterator end)
|
||||||
|
: container(new instance< iter_cursor<Iterator> >(iter_cursor<Iterator>(begin, end)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic_cursor<T> get_cursor() const {
|
||||||
|
return container ? container->get_cursor() : dynamic_cursor<T>();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !defined(CPPLINQ_LINQ_CURSOR_HPP
|
195
3party/rxcpp/Ix/CPP/src/cpplinq/linq_groupby.hpp
Normal file
195
3party/rxcpp/Ix/CPP/src/cpplinq/linq_groupby.hpp
Normal file
@ -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 <class Iter, class Key>
|
||||||
|
struct group
|
||||||
|
{
|
||||||
|
Key key;
|
||||||
|
Iter start;
|
||||||
|
Iter fin;
|
||||||
|
|
||||||
|
typedef Iter iterator;
|
||||||
|
typedef Iter const_iterator;
|
||||||
|
|
||||||
|
group(){}
|
||||||
|
|
||||||
|
group(const Key& key) : key(key)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Iter begin() const { return start; }
|
||||||
|
Iter end() const { return fin; }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct default_equality
|
||||||
|
{
|
||||||
|
template <class T>
|
||||||
|
bool operator()(const T& a, const T& b) const {
|
||||||
|
return a == b;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
struct default_less
|
||||||
|
{
|
||||||
|
template<class T>
|
||||||
|
bool operator()(const T& a, const T& b) const {
|
||||||
|
return a < b;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// progressively constructs grouping as user iterates over groups and elements
|
||||||
|
// within each group. Performs this task by building a std::list of element
|
||||||
|
// iterators with equal elements within each group.
|
||||||
|
//
|
||||||
|
// invariants:
|
||||||
|
// - relative order of groups corresponds to relative order of each group's first
|
||||||
|
// element, as they appeared in the input sequence.
|
||||||
|
// - relative order of elements within a group correspond to relative order
|
||||||
|
// as they appeared in the input sequence.
|
||||||
|
//
|
||||||
|
// requires:
|
||||||
|
// Iter must be a forward iterator.
|
||||||
|
template <class Collection, class KeyFn, class Compare = default_less>
|
||||||
|
class linq_groupby
|
||||||
|
{
|
||||||
|
typedef typename Collection::cursor
|
||||||
|
inner_cursor;
|
||||||
|
|
||||||
|
typedef typename util::result_of<KeyFn(typename inner_cursor::element_type)>::type
|
||||||
|
key_type;
|
||||||
|
|
||||||
|
typedef std::list<typename inner_cursor::element_type>
|
||||||
|
element_list_type;
|
||||||
|
|
||||||
|
typedef group<typename element_list_type::iterator, key_type>
|
||||||
|
group_type;
|
||||||
|
|
||||||
|
typedef std::list<group_type>
|
||||||
|
group_list_type;
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct impl_t
|
||||||
|
{
|
||||||
|
// TODO: would be faster to use a chunked list, where
|
||||||
|
// pointers are invalidated but iterators are not. Need
|
||||||
|
// benchmarks first
|
||||||
|
|
||||||
|
element_list_type elements;
|
||||||
|
std::list<group_type> groups;
|
||||||
|
std::map<key_type, group_type*, Compare> groupIndex;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
KeyFn keySelector;
|
||||||
|
Compare comp;
|
||||||
|
|
||||||
|
impl_t(inner_cursor cur,
|
||||||
|
KeyFn keySelector,
|
||||||
|
Compare comp = Compare())
|
||||||
|
: keySelector(keySelector)
|
||||||
|
, groupIndex(comp)
|
||||||
|
{
|
||||||
|
// TODO: make lazy
|
||||||
|
insert_all(std::move(cur));
|
||||||
|
}
|
||||||
|
|
||||||
|
void insert_all(inner_cursor cur)
|
||||||
|
{
|
||||||
|
while(!cur.empty()) {
|
||||||
|
insert(cur.get());
|
||||||
|
cur.inc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void insert(typename inner_cursor::reference_type element)
|
||||||
|
{
|
||||||
|
key_type key = keySelector(element);
|
||||||
|
auto groupPos = groupIndex.find(key);
|
||||||
|
if(groupPos == groupIndex.end()) {
|
||||||
|
// new group
|
||||||
|
bool firstGroup = groups.empty();
|
||||||
|
|
||||||
|
elements.push_back(element);
|
||||||
|
if(!firstGroup) {
|
||||||
|
// pop new element out of previous group
|
||||||
|
--groups.back().fin;
|
||||||
|
}
|
||||||
|
|
||||||
|
// build new group
|
||||||
|
groups.push_back(group_type(key));
|
||||||
|
group_type& newGroup = groups.back();
|
||||||
|
|
||||||
|
groupIndex.insert( std::make_pair(key, &newGroup) );
|
||||||
|
|
||||||
|
newGroup.fin = elements.end();
|
||||||
|
--(newGroup.start = newGroup.fin);
|
||||||
|
} else {
|
||||||
|
// add to existing group at end
|
||||||
|
elements.insert(groupPos->second->end(), element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
struct cursor {
|
||||||
|
typedef group_type
|
||||||
|
element_type;
|
||||||
|
|
||||||
|
typedef element_type
|
||||||
|
reference_type;
|
||||||
|
|
||||||
|
typedef forward_cursor_tag
|
||||||
|
cursor_category;
|
||||||
|
|
||||||
|
cursor(inner_cursor cur,
|
||||||
|
KeyFn keyFn,
|
||||||
|
Compare comp = Compare())
|
||||||
|
{
|
||||||
|
impl.reset(new impl_t(cur, keyFn, comp));
|
||||||
|
inner = impl->groups.begin();
|
||||||
|
fin = impl->groups.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void forget() { } // nop on forward-only cursors
|
||||||
|
bool empty() const {
|
||||||
|
return inner == fin;
|
||||||
|
}
|
||||||
|
void inc() {
|
||||||
|
if (inner == fin) {
|
||||||
|
throw std::logic_error("attempt to iterate past end of range");
|
||||||
|
}
|
||||||
|
++inner;
|
||||||
|
}
|
||||||
|
reference_type get() const {
|
||||||
|
return *inner;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::shared_ptr<impl_t> impl;
|
||||||
|
typename std::list<group_type>::iterator inner;
|
||||||
|
typename std::list<group_type>::iterator fin;
|
||||||
|
};
|
||||||
|
|
||||||
|
linq_groupby(Collection c,
|
||||||
|
KeyFn keyFn,
|
||||||
|
Compare comp = Compare())
|
||||||
|
: c(c), keyFn(keyFn), comp(comp)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor get_cursor() const { return cursor(c.get_cursor(), keyFn, comp); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
Collection c;
|
||||||
|
KeyFn keyFn;
|
||||||
|
Compare comp;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !defined(CPPLINQ_LINQ_GROUPBY_HPP)
|
||||||
|
|
196
3party/rxcpp/Ix/CPP/src/cpplinq/linq_iterators.hpp
Normal file
196
3party/rxcpp/Ix/CPP/src/cpplinq/linq_iterators.hpp
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#if !defined(CPPLINQ_LINQ_ITERATORS_HPP)
|
||||||
|
#define CPPLINQ_LINQ_ITERATORS_HPP
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
namespace cpplinq {
|
||||||
|
|
||||||
|
// if a member, provides the straightforward implementation of various redundant operators. For example,
|
||||||
|
// providing -> for any iterator providing *, and so forth.
|
||||||
|
struct use_default_iterator_operators {};
|
||||||
|
|
||||||
|
#define CPPLINQ_USE_DEFAULT_ITERATOR_OPERATORS \
|
||||||
|
operator ::cpplinq::use_default_iterator_operators() const { return ::cpplinq::use_default_iterator_operators(); }
|
||||||
|
|
||||||
|
template <class Iter>
|
||||||
|
typename std::enable_if<
|
||||||
|
std::is_convertible<Iter, use_default_iterator_operators>::value,
|
||||||
|
Iter
|
||||||
|
>::type
|
||||||
|
operator+(const Iter& it, typename std::iterator_traits<Iter>::distance_type n) {
|
||||||
|
return it += n;
|
||||||
|
}
|
||||||
|
template <class Iter>
|
||||||
|
typename std::enable_if<
|
||||||
|
std::is_convertible<Iter, use_default_iterator_operators>::value,
|
||||||
|
Iter
|
||||||
|
>::type
|
||||||
|
operator-(const Iter& it, typename std::iterator_traits<Iter>::distance_type n) {
|
||||||
|
return it -= n;
|
||||||
|
}
|
||||||
|
template <class Iter>
|
||||||
|
typename std::enable_if<
|
||||||
|
std::is_convertible<Iter, use_default_iterator_operators>::value,
|
||||||
|
Iter
|
||||||
|
>::type
|
||||||
|
operator-=(const Iter& it, typename std::iterator_traits<Iter>::distance_type n) {
|
||||||
|
return it += (-n);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Iter>
|
||||||
|
typename std::enable_if<
|
||||||
|
std::is_convertible<Iter, use_default_iterator_operators>::value,
|
||||||
|
bool
|
||||||
|
>::type
|
||||||
|
operator!=(const Iter& it, const Iter& it2) {
|
||||||
|
return !(it == it2);
|
||||||
|
}
|
||||||
|
template <class Iter>
|
||||||
|
typename std::enable_if<
|
||||||
|
std::is_convertible<Iter, use_default_iterator_operators>::value,
|
||||||
|
bool
|
||||||
|
>::type
|
||||||
|
operator>(const Iter& it, const Iter& it2) {
|
||||||
|
return it2 < it;
|
||||||
|
}
|
||||||
|
template <class Iter>
|
||||||
|
typename std::enable_if<
|
||||||
|
std::is_convertible<Iter, use_default_iterator_operators>::value,
|
||||||
|
bool
|
||||||
|
>::type
|
||||||
|
operator<=(const Iter& it, const Iter& it2) {
|
||||||
|
return !(it2 < it);
|
||||||
|
}
|
||||||
|
template <class Iter>
|
||||||
|
typename std::enable_if<
|
||||||
|
std::is_convertible<Iter, use_default_iterator_operators>::value,
|
||||||
|
bool
|
||||||
|
>::type
|
||||||
|
operator>=(const Iter& it, const Iter& it2) {
|
||||||
|
return !(it < it2);
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace util {
|
||||||
|
template <class Iter, class T>
|
||||||
|
typename std::iterator_traits<Iter>::pointer deref_iterator(const Iter& it) {
|
||||||
|
return deref_iterator(it, util::identity<typename std::iterator_traits<Iter>::reference>());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Iter, class T>
|
||||||
|
T* deref_iterator(const Iter& it, util::identity<T&>) {
|
||||||
|
return &*it;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Iter, class T>
|
||||||
|
util::value_ptr<T> deref_iterator(const Iter& it, util::identity<T>) {
|
||||||
|
return util::value_ptr<T>(*it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class Iter>
|
||||||
|
class iter_range
|
||||||
|
{
|
||||||
|
Iter start, finish;
|
||||||
|
public:
|
||||||
|
|
||||||
|
CPPLINQ_USE_DEFAULT_ITERATOR_OPERATORS
|
||||||
|
|
||||||
|
typedef Iter iterator;
|
||||||
|
typedef typename iterator::value_type value_type;
|
||||||
|
|
||||||
|
explicit iter_range(Iter start, Iter finish) : start(start), finish(finish) {}
|
||||||
|
iterator begin() const { return start; }
|
||||||
|
iterator end() const { return finish; }
|
||||||
|
};
|
||||||
|
template <class Iter>
|
||||||
|
iter_range<Iter> make_range(Iter start, Iter finish) {
|
||||||
|
return iter_range<Iter>(start, finish);
|
||||||
|
}
|
||||||
|
|
||||||
|
// decays into a onepass/forward iterator
|
||||||
|
template <class Cursor>
|
||||||
|
class cursor_iterator
|
||||||
|
: public std::iterator<std::forward_iterator_tag,
|
||||||
|
typename Cursor::element_type,
|
||||||
|
std::ptrdiff_t,
|
||||||
|
typename std::conditional<std::is_reference<typename Cursor::reference_type>::value,
|
||||||
|
typename std::add_pointer<typename Cursor::element_type>::type,
|
||||||
|
util::value_ptr<typename Cursor::element_type>>::type,
|
||||||
|
typename Cursor::reference_type>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CPPLINQ_USE_DEFAULT_ITERATOR_OPERATORS;
|
||||||
|
|
||||||
|
cursor_iterator(Cursor cur) : cur(cur) {
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor_iterator() : cur() {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const cursor_iterator& other) const {
|
||||||
|
return !cur && !other.cur;
|
||||||
|
}
|
||||||
|
|
||||||
|
typename Cursor::reference_type operator*() const {
|
||||||
|
return cur->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
typename cursor_iterator::pointer operator->() const {
|
||||||
|
auto& v = **this;
|
||||||
|
return &v;
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor_iterator& operator++() {
|
||||||
|
cur->inc();
|
||||||
|
|
||||||
|
if (cur->empty()) { cur.reset(); }
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor_iterator& operator+=(std::ptrdiff_t n) {
|
||||||
|
cur->skip(n);
|
||||||
|
|
||||||
|
if (cur->empty()) { cur.reset(); }
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool empty() const {
|
||||||
|
!cur || cur->empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
util::maybe<Cursor> cur;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class Container>
|
||||||
|
class container_range
|
||||||
|
{
|
||||||
|
Container c;
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef cursor_iterator<typename Container::cursor> iterator;
|
||||||
|
|
||||||
|
container_range(Container c) : c(c)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator begin() const
|
||||||
|
{
|
||||||
|
return iterator(c.get_cursor());
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator end() const
|
||||||
|
{
|
||||||
|
return iterator();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
85
3party/rxcpp/Ix/CPP/src/cpplinq/linq_last.hpp
Normal file
85
3party/rxcpp/Ix/CPP/src/cpplinq/linq_last.hpp
Normal file
@ -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 <class Cursor>
|
||||||
|
typename Cursor::element_type
|
||||||
|
linq_last_(Cursor c, onepass_cursor_tag)
|
||||||
|
{
|
||||||
|
if (c.empty()) { throw std::logic_error("last() out of bounds"); }
|
||||||
|
typename Cursor::element_type elem = c.get();
|
||||||
|
for(;;) {
|
||||||
|
c.inc();
|
||||||
|
if (c.empty()) break;
|
||||||
|
elem = c.get();
|
||||||
|
}
|
||||||
|
return elem;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: bidirectional iterator in constant time
|
||||||
|
|
||||||
|
template <class Cursor>
|
||||||
|
typename Cursor::reference_type
|
||||||
|
linq_last_(Cursor c, forward_cursor_tag)
|
||||||
|
{
|
||||||
|
if (c.empty()) { throw std::logic_error("last() out of bounds"); }
|
||||||
|
Cursor best = c;
|
||||||
|
for(;;) {
|
||||||
|
c.inc();
|
||||||
|
if (c.empty()) break;
|
||||||
|
best = c;
|
||||||
|
}
|
||||||
|
return best.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Cursor>
|
||||||
|
typename Cursor::reference_type
|
||||||
|
linq_last_(Cursor c, random_access_cursor_tag)
|
||||||
|
{
|
||||||
|
if (c.empty()) { throw std::logic_error("last() out of bounds"); }
|
||||||
|
c.skip(c.size()-1);
|
||||||
|
return c.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Cursor>
|
||||||
|
typename Cursor::element_type
|
||||||
|
linq_last_or_default_(Cursor c, onepass_cursor_tag)
|
||||||
|
{
|
||||||
|
typename Cursor::element_type elem;
|
||||||
|
while(!c.empty()) {
|
||||||
|
elem = c.get();
|
||||||
|
c.inc();
|
||||||
|
}
|
||||||
|
return elem;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Cursor>
|
||||||
|
typename Cursor::element_type
|
||||||
|
linq_last_or_default_(Cursor c, forward_cursor_tag)
|
||||||
|
{
|
||||||
|
if (c.empty()) { throw std::logic_error("last() out of bounds"); }
|
||||||
|
Cursor best = c;
|
||||||
|
for(;;) {
|
||||||
|
c.inc();
|
||||||
|
if (c.empty()) break;
|
||||||
|
best = c;
|
||||||
|
}
|
||||||
|
return best.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Cursor>
|
||||||
|
typename Cursor::element_type
|
||||||
|
linq_last_or_default_(Cursor c, random_access_cursor_tag)
|
||||||
|
{
|
||||||
|
if (c.empty()) { return typename Cursor::element_type(); }
|
||||||
|
c.skip(c.size()-1);
|
||||||
|
return c.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // CPPLINQ_LINQ_LAST_HPP
|
54
3party/rxcpp/Ix/CPP/src/cpplinq/linq_select.hpp
Normal file
54
3party/rxcpp/Ix/CPP/src/cpplinq/linq_select.hpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#if !defined(CPPLINQ_LINQ_SELECT_HPP)
|
||||||
|
#define CPPLINQ_LINQ_SELECT_HPP
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
namespace cpplinq
|
||||||
|
{
|
||||||
|
template <class Collection, class Selector>
|
||||||
|
class linq_select
|
||||||
|
{
|
||||||
|
typedef typename Collection::cursor
|
||||||
|
inner_cursor;
|
||||||
|
public:
|
||||||
|
struct cursor {
|
||||||
|
typedef typename util::result_of<Selector(typename inner_cursor::element_type)>::type
|
||||||
|
reference_type;
|
||||||
|
typedef typename std::remove_reference<reference_type>::type
|
||||||
|
element_type;
|
||||||
|
typedef typename inner_cursor::cursor_category
|
||||||
|
cursor_category;
|
||||||
|
|
||||||
|
cursor(const inner_cursor& cur, Selector sel) : cur(cur), sel(std::move(sel)) {}
|
||||||
|
|
||||||
|
void forget() { cur.forget(); }
|
||||||
|
bool empty() const { return cur.empty(); }
|
||||||
|
void inc() { cur.inc(); }
|
||||||
|
reference_type get() const { return sel(cur.get()); }
|
||||||
|
|
||||||
|
bool atbegin() const { return cur.atbegin(); }
|
||||||
|
void dec() { cur.dec(); }
|
||||||
|
|
||||||
|
void skip(std::size_t n) { cur.skip(n); }
|
||||||
|
std::size_t position() const { return cur.position(); }
|
||||||
|
std::size_t size() const { return cur.size(); }
|
||||||
|
private:
|
||||||
|
inner_cursor cur;
|
||||||
|
Selector sel;
|
||||||
|
};
|
||||||
|
|
||||||
|
linq_select(const Collection& c, Selector sel) : c(c), sel(sel) {}
|
||||||
|
|
||||||
|
cursor get_cursor() const { return cursor(c.get_cursor(), sel); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
Collection c;
|
||||||
|
Selector sel;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // defined(CPPLINQ_LINQ_SELECT_HPP)
|
164
3party/rxcpp/Ix/CPP/src/cpplinq/linq_selectmany.hpp
Normal file
164
3party/rxcpp/Ix/CPP/src/cpplinq/linq_selectmany.hpp
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "util.hpp"
|
||||||
|
#include "linq_cursor.hpp"
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
namespace cpplinq
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
struct default_select_many_selector
|
||||||
|
{
|
||||||
|
template <class T1, class T2>
|
||||||
|
auto operator()(T1&& t1, T2&& t2) const
|
||||||
|
-> decltype(std::forward<T2>(t2))
|
||||||
|
{
|
||||||
|
return std::forward<T2>(t2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template <typename Fn, typename Arg>
|
||||||
|
struct resolve_select_many_fn_return_type
|
||||||
|
{
|
||||||
|
typedef decltype(std::declval<Fn>()(std::declval<Arg>())) value;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename TCol>
|
||||||
|
struct value_collection_adapter
|
||||||
|
{
|
||||||
|
value_collection_adapter(const TCol& col)
|
||||||
|
: _collection(col){}
|
||||||
|
|
||||||
|
value_collection_adapter(const value_collection_adapter& src)
|
||||||
|
: _collection(src._collection) {}
|
||||||
|
|
||||||
|
value_collection_adapter(value_collection_adapter && src)
|
||||||
|
: _collection(std::move(src._collection)) {}
|
||||||
|
|
||||||
|
const TCol& get() const
|
||||||
|
{
|
||||||
|
return _collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
TCol& get()
|
||||||
|
{
|
||||||
|
return _collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
TCol _collection;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename TCol>
|
||||||
|
struct collection_store_type
|
||||||
|
{
|
||||||
|
typedef typename std::remove_reference<TCol>::type collection_type;
|
||||||
|
typedef std::reference_wrapper<collection_type> reference_store_type;
|
||||||
|
typedef value_collection_adapter<collection_type> value_store_type;
|
||||||
|
|
||||||
|
typedef typename std::conditional<std::is_reference<TCol>::value, reference_store_type, value_store_type>::type store;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// cur<T> -> (T -> cur<element_type>) -> cur<element_type>
|
||||||
|
template <class Container1, class Fn, class Fn2>
|
||||||
|
class linq_select_many
|
||||||
|
{
|
||||||
|
template <class T> static T instance(); // for type inference
|
||||||
|
|
||||||
|
Container1 c1;
|
||||||
|
Fn fn;
|
||||||
|
Fn2 fn2;
|
||||||
|
|
||||||
|
typedef typename Container1::cursor Cur1;
|
||||||
|
typedef decltype(from(instance<Fn>()(instance<Cur1>().get()))) Container2;
|
||||||
|
typedef typename Container2::cursor Cur2;
|
||||||
|
|
||||||
|
typedef typename detail::resolve_select_many_fn_return_type<Fn, typename Cur1::element_type>::value inner_collection;
|
||||||
|
|
||||||
|
public:
|
||||||
|
class cursor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename util::min_cursor_category<typename Cur1::cursor_category,
|
||||||
|
typename Cur2::cursor_category,
|
||||||
|
forward_cursor_tag>::type
|
||||||
|
cursor_category;
|
||||||
|
typedef typename Cur2::reference_type reference_type;
|
||||||
|
typedef typename Cur2::element_type element_type;
|
||||||
|
|
||||||
|
typedef detail::collection_store_type<inner_collection> collection_store_type;
|
||||||
|
typedef typename collection_store_type::store collection_store;
|
||||||
|
typedef std::shared_ptr<collection_store> collection_store_ptr;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// TODO: we need to lazy eval somehow, but this feels wrong.
|
||||||
|
Cur1 cur1;
|
||||||
|
dynamic_cursor<reference_type> cur2;
|
||||||
|
Fn fn;
|
||||||
|
Fn2 fn2;
|
||||||
|
collection_store_ptr store;
|
||||||
|
|
||||||
|
public:
|
||||||
|
cursor(Cur1 cur1, const Fn& fn, const Fn2& fn2)
|
||||||
|
: cur1(std::move(cur1)), fn(fn), fn2(fn2)
|
||||||
|
{
|
||||||
|
if (!cur1.empty())
|
||||||
|
{
|
||||||
|
store = std::make_shared<collection_store>(fn(cur1.get()));
|
||||||
|
cur2 = from(store->get()).get_cursor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool empty() const
|
||||||
|
{
|
||||||
|
return cur2.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inc()
|
||||||
|
{
|
||||||
|
cur2.inc();
|
||||||
|
thunk();
|
||||||
|
}
|
||||||
|
|
||||||
|
reference_type get() const
|
||||||
|
{
|
||||||
|
return fn2(cur1.get(), cur2.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void thunk()
|
||||||
|
{
|
||||||
|
// refill cur2
|
||||||
|
while (cur2.empty() && !cur1.empty()) {
|
||||||
|
cur1.inc();
|
||||||
|
if (cur1.empty())
|
||||||
|
break;
|
||||||
|
|
||||||
|
store = std::make_shared<collection_store>(fn(cur1.get()));
|
||||||
|
cur2 = from(store->get()).get_cursor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
linq_select_many(Container1 c1, Fn fn, Fn2 fn2)
|
||||||
|
: c1(std::move(c1)), fn(std::move(fn)), fn2(std::move(fn2))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor get_cursor() const
|
||||||
|
{
|
||||||
|
return cursor(c1.get_cursor(), fn, fn2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
37
3party/rxcpp/Ix/CPP/src/cpplinq/linq_skip.hpp
Normal file
37
3party/rxcpp/Ix/CPP/src/cpplinq/linq_skip.hpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#if !defined(CPPLINQ_LINQ_SKIP_HPP)
|
||||||
|
#define CPPLINQ_LINQ_SKIP_HPP
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
namespace cpplinq
|
||||||
|
{
|
||||||
|
template <class Collection>
|
||||||
|
struct linq_skip
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Collection::cursor cursor;
|
||||||
|
|
||||||
|
linq_skip(const Collection& c, std::size_t n) : c(c), n(n) {}
|
||||||
|
|
||||||
|
cursor get_cursor() const {
|
||||||
|
std::size_t rem = n;
|
||||||
|
|
||||||
|
auto cur = c.get_cursor();
|
||||||
|
while(rem-- && !cur.empty()) {
|
||||||
|
cur.inc();
|
||||||
|
}
|
||||||
|
cur.forget();
|
||||||
|
return cur;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Collection c;
|
||||||
|
std::size_t n;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif // !defined(CPPLINQ_LINQ_SKIP_HPP)
|
||||||
|
|
||||||
|
|
98
3party/rxcpp/Ix/CPP/src/cpplinq/linq_take.hpp
Normal file
98
3party/rxcpp/Ix/CPP/src/cpplinq/linq_take.hpp
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#if !defined(CPPLINQ_LINQ_TAKE_HPP)
|
||||||
|
#define CPPLINQ_LINQ_TAKE_HPP
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
namespace cpplinq
|
||||||
|
{
|
||||||
|
template <class InnerCursor>
|
||||||
|
struct linq_take_cursor
|
||||||
|
{
|
||||||
|
typedef typename InnerCursor::element_type element_type;
|
||||||
|
typedef typename InnerCursor::reference_type reference_type;
|
||||||
|
typedef typename InnerCursor::cursor_category cursor_category;
|
||||||
|
|
||||||
|
linq_take_cursor(const InnerCursor& cur, std::size_t rem) : cur(cur), rem(rem) {}
|
||||||
|
|
||||||
|
void forget() { cur.forget(); }
|
||||||
|
bool empty() const { return cur.empty() || rem == 0; }
|
||||||
|
void inc() { cur.inc(); --rem; }
|
||||||
|
reference_type get() const { return cur.get(); }
|
||||||
|
|
||||||
|
bool atbegin() const { return cur.atbegin(); }
|
||||||
|
void dec() { cur.dec(); --rem; }
|
||||||
|
|
||||||
|
void skip(std::size_t n) { cur.skip(n); rem -= n; }
|
||||||
|
std::size_t position() const { return cur.position(); }
|
||||||
|
std::size_t size() const { return cur.size(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
InnerCursor cur;
|
||||||
|
std::size_t rem;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
template <class Collection>
|
||||||
|
linq_take_cursor<typename Collection::cursor>
|
||||||
|
take_get_cursor_(
|
||||||
|
const Collection& c,
|
||||||
|
std::size_t n,
|
||||||
|
onepass_cursor_tag
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return linq_take_cursor<typename Collection::cursor>(c.get_cursor(), n);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Collection>
|
||||||
|
typename Collection::cursor
|
||||||
|
take_get_cursor_(
|
||||||
|
const Collection& c,
|
||||||
|
std::size_t n,
|
||||||
|
random_access_cursor_tag
|
||||||
|
)
|
||||||
|
{
|
||||||
|
auto cur = c.get_cursor();
|
||||||
|
if (cur.size() > n) {
|
||||||
|
cur.truncate(n);
|
||||||
|
}
|
||||||
|
return cur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Collection>
|
||||||
|
struct linq_take
|
||||||
|
{
|
||||||
|
typedef typename std::conditional<
|
||||||
|
util::less_or_equal_cursor_category<
|
||||||
|
random_access_cursor_tag,
|
||||||
|
typename Collection::cursor::cursor_category>::value,
|
||||||
|
typename Collection::cursor,
|
||||||
|
linq_take_cursor<typename Collection::cursor>>::type
|
||||||
|
cursor;
|
||||||
|
|
||||||
|
linq_take(const Collection& c, std::size_t n) : c(c), n(n) {}
|
||||||
|
|
||||||
|
cursor get_cursor() const {
|
||||||
|
return detail::take_get_cursor_(c, n, typename Collection::cursor::cursor_category());
|
||||||
|
}
|
||||||
|
|
||||||
|
Collection c;
|
||||||
|
std::size_t n;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class Collection>
|
||||||
|
auto get_cursor(
|
||||||
|
const linq_take<Collection>& take
|
||||||
|
)
|
||||||
|
-> decltype(get_cursor_(take, typename Collection::cursor::cursor_category()))
|
||||||
|
{
|
||||||
|
return get_cursor_(take, typename Collection::cursor::cursor_category());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif // !defined(CPPLINQ_LINQ_TAKE_HPP)
|
||||||
|
|
69
3party/rxcpp/Ix/CPP/src/cpplinq/linq_where.hpp
Normal file
69
3party/rxcpp/Ix/CPP/src/cpplinq/linq_where.hpp
Normal file
@ -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 Collection, class Predicate>
|
||||||
|
class linq_where
|
||||||
|
{
|
||||||
|
typedef typename Collection::cursor
|
||||||
|
inner_cursor;
|
||||||
|
public:
|
||||||
|
struct cursor {
|
||||||
|
typedef typename util::min_iterator_category<
|
||||||
|
bidirectional_cursor_tag,
|
||||||
|
typename inner_cursor::cursor_category>::type
|
||||||
|
cursor_category;
|
||||||
|
typedef typename inner_cursor::element_type
|
||||||
|
element_type;
|
||||||
|
typedef typename inner_cursor::reference_type
|
||||||
|
reference_type;
|
||||||
|
|
||||||
|
cursor(const inner_cursor& cur, const Predicate& p) : cur(cur), pred(p)
|
||||||
|
{
|
||||||
|
if (!cur.empty() && !pred(cur.get())) {
|
||||||
|
this->inc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void forget() { cur.forget(); }
|
||||||
|
bool empty() const { return cur.empty(); }
|
||||||
|
void inc() {
|
||||||
|
for (;;) {
|
||||||
|
cur.inc();
|
||||||
|
if (cur.empty() || pred(cur.get())) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reference_type get() const {
|
||||||
|
return cur.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool atbegin() const { return atbegin(cur); }
|
||||||
|
void dec() {
|
||||||
|
for (;;) {
|
||||||
|
cur.dec();
|
||||||
|
if (pred(cur.get())) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
inner_cursor cur;
|
||||||
|
Predicate pred;
|
||||||
|
};
|
||||||
|
|
||||||
|
linq_where(const Collection& c, Predicate pred) : c(c), pred(pred) {}
|
||||||
|
|
||||||
|
cursor get_cursor() const {
|
||||||
|
return cursor(c.get_cursor(), pred);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Collection c;
|
||||||
|
Predicate pred;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !defined(CPPLINQ_LINQ_WHERE_HPP)
|
||||||
|
|
232
3party/rxcpp/Ix/CPP/src/cpplinq/util.hpp
Normal file
232
3party/rxcpp/Ix/CPP/src/cpplinq/util.hpp
Normal file
@ -0,0 +1,232 @@
|
|||||||
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#if !defined(CPPLINQ_LINQ_UTIL_HPP)
|
||||||
|
#define CPPLINQ_LINQ_UTIL_HPP
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace cpplinq { namespace util {
|
||||||
|
|
||||||
|
template <class Container>
|
||||||
|
struct container_traits {
|
||||||
|
typedef typename Container::iterator iterator;
|
||||||
|
typedef typename std::iterator_traits<iterator>::value_type value_type;
|
||||||
|
typedef typename std::iterator_traits<iterator>::iterator_category iterator_category;
|
||||||
|
|
||||||
|
// TODO: conservative definition for now.
|
||||||
|
enum { is_writable_iterator =
|
||||||
|
std::is_reference<typename std::iterator_traits<iterator>::reference>::value
|
||||||
|
&& std::is_same<typename std::remove_cv<value_type>::type,
|
||||||
|
typename std::remove_cv<typename std::remove_reference<typename std::iterator_traits<iterator>::reference>::type>::type>::value
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct container_traits<int>;
|
||||||
|
|
||||||
|
template <class Container>
|
||||||
|
struct container_traits<Container&>
|
||||||
|
: container_traits<Container>
|
||||||
|
{};
|
||||||
|
template <class Container>
|
||||||
|
struct container_traits<const Container>
|
||||||
|
: container_traits<Container>
|
||||||
|
{
|
||||||
|
typedef typename Container::const_iterator iterator;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Note: returns false if no partial order exists between two
|
||||||
|
// particular iterator categories, such as with some of the boost categories
|
||||||
|
template <class Cat1, class Cat2>
|
||||||
|
struct less_or_equal_iterator_category
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
typedef char yes;
|
||||||
|
typedef struct { char c1,c2; } no;
|
||||||
|
static yes invoke(Cat1);
|
||||||
|
static no invoke(...);
|
||||||
|
public:
|
||||||
|
enum { value = (sizeof(invoke(Cat2())) == sizeof(yes)) };
|
||||||
|
};
|
||||||
|
|
||||||
|
// Return the weaker of the two iterator categories. Make sure
|
||||||
|
// a non-standard category is in the second argument position, as
|
||||||
|
// this metafunction will default to the first value if the order is undefined
|
||||||
|
template <class Cat1, class Cat2>
|
||||||
|
struct min_iterator_category
|
||||||
|
: std::conditional<
|
||||||
|
less_or_equal_iterator_category<Cat2, Cat1>::value,
|
||||||
|
Cat2,
|
||||||
|
Cat1>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#define CppLinq_GET_ITERATOR_TYPE(TContainer) \
|
||||||
|
decltype(begin(static_cast<TContainer*>(0)))
|
||||||
|
#define CppLinq_GET_CONST_ITERATOR_TYPE(TContainer) \
|
||||||
|
decltype(begin(static_cast<const TContainer*>(0)))
|
||||||
|
#else
|
||||||
|
#define CppLinq_GET_ITERATOR_TYPE(TContainer) \
|
||||||
|
typename ::cpplinq::util::container_traits<TContainer>::iterator
|
||||||
|
#define CppLinq_GET_CONST_ITERATOR_TYPE(TContainer) \
|
||||||
|
typename ::cpplinq::util::container_traits<TContainer>::const_iterator
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// VC10's std::tr1::result_of is busted with lambdas. use decltype instead on vc10 and later
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER >= 1600
|
||||||
|
namespace detail {
|
||||||
|
template <class T> T instance();
|
||||||
|
};
|
||||||
|
template <class Fn> struct result_of;
|
||||||
|
template <class Fn>
|
||||||
|
struct result_of<Fn()> {
|
||||||
|
typedef decltype(detail::instance<Fn>()()) type;
|
||||||
|
};
|
||||||
|
template <class Fn, class A0>
|
||||||
|
struct result_of<Fn(A0)> {
|
||||||
|
typedef decltype(detail::instance<Fn>()(detail::instance<A0>())) type;
|
||||||
|
};
|
||||||
|
template <class Fn, class A0, class A1>
|
||||||
|
struct result_of<Fn(A0,A1)> {
|
||||||
|
typedef decltype(detail::instance<Fn>()(detail::instance<A0>(),
|
||||||
|
detail::instance<A1>())) type;
|
||||||
|
};
|
||||||
|
template <class Fn, class A0, class A1, class A2>
|
||||||
|
struct result_of<Fn(A0,A1,A2)> {
|
||||||
|
typedef decltype(detail::instance<Fn>()(detail::instance<A0>(),
|
||||||
|
detail::instance<A1>(),
|
||||||
|
detail::instance<A2>())) type;
|
||||||
|
};
|
||||||
|
template <class Fn, class A0, class A1, class A2, class A3>
|
||||||
|
struct result_of<Fn(A0,A1,A2,A3)> {
|
||||||
|
typedef decltype(detail::instance<Fn>()(detail::instance<A0>(),
|
||||||
|
detail::instance<A1>(),
|
||||||
|
detail::instance<A2>(),
|
||||||
|
detail::instance<A3>())) type;
|
||||||
|
};
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
template <class T>
|
||||||
|
struct result_of<T> : std::tr1::result_of<T> {};
|
||||||
|
#else
|
||||||
|
using std::result_of;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
struct identity
|
||||||
|
{
|
||||||
|
typedef Type type;
|
||||||
|
Type operator()(const Type& left) const {return left;}
|
||||||
|
};
|
||||||
|
|
||||||
|
// faux pointer proxy for iterators that dereference to a value rather than reference, such as selectors
|
||||||
|
template <class T>
|
||||||
|
struct value_ptr
|
||||||
|
{
|
||||||
|
T value;
|
||||||
|
value_ptr(const T& value) : value(value)
|
||||||
|
{}
|
||||||
|
value_ptr(const T* pvalue) : value(*pvalue)
|
||||||
|
{}
|
||||||
|
const T* operator->()
|
||||||
|
{
|
||||||
|
return &value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class maybe
|
||||||
|
{
|
||||||
|
bool is_set;
|
||||||
|
typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type
|
||||||
|
storage;
|
||||||
|
public:
|
||||||
|
maybe()
|
||||||
|
: is_set(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
maybe(T value)
|
||||||
|
: is_set(false)
|
||||||
|
{
|
||||||
|
new (reinterpret_cast<T*>(&storage)) T(value);
|
||||||
|
is_set = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
maybe(const maybe& other)
|
||||||
|
: is_set(false)
|
||||||
|
{
|
||||||
|
if (other.is_set) {
|
||||||
|
new (reinterpret_cast<T*>(&storage)) T(*other.get());
|
||||||
|
is_set = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maybe(maybe&& other)
|
||||||
|
: is_set(false)
|
||||||
|
{
|
||||||
|
if (other.is_set) {
|
||||||
|
new (reinterpret_cast<T*>(&storage)) T(std::move(*other.get()));
|
||||||
|
is_set = true;
|
||||||
|
other.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
~maybe()
|
||||||
|
{
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
if (is_set) {
|
||||||
|
is_set = false;
|
||||||
|
reinterpret_cast<T*>(&storage)->~T();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
T* get() {
|
||||||
|
return is_set ? reinterpret_cast<T*>(&storage) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const T* get() const {
|
||||||
|
return is_set ? reinterpret_cast<const T*>(&storage) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set(T value) {
|
||||||
|
if (is_set) {
|
||||||
|
*reinterpret_cast<T*>(&storage) = std::move(value);
|
||||||
|
} else {
|
||||||
|
new (reinterpret_cast<T*>(&storage)) T(std::move(value));
|
||||||
|
is_set = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
T& operator*() { return *get(); }
|
||||||
|
const T& operator*() const { return *get(); }
|
||||||
|
T* operator->() { return get(); }
|
||||||
|
const T* operator->() const { return get(); }
|
||||||
|
|
||||||
|
maybe& operator=(const T& other) {
|
||||||
|
set(other);
|
||||||
|
}
|
||||||
|
maybe& operator=(const maybe& other) {
|
||||||
|
if (const T* pother = other.get()) {
|
||||||
|
set(*pother);
|
||||||
|
} else {
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// boolean-like operators
|
||||||
|
operator T*() { return get(); }
|
||||||
|
operator const T*() const { return get(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
#endif //CPPLINQ_UTIL_HPP
|
||||||
|
|
610
3party/rxcpp/Ix/CPP/unittest/testbench.cpp
Normal file
610
3party/rxcpp/Ix/CPP/unittest/testbench.cpp
Normal file
@ -0,0 +1,610 @@
|
|||||||
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <vector>
|
||||||
|
#include <functional>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <numeric>
|
||||||
|
#include <iterator>
|
||||||
|
#include <string>
|
||||||
|
#include <complex>
|
||||||
|
|
||||||
|
#include <ctime>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
#include <boost/lambda/core.hpp>
|
||||||
|
#include <boost/lambda/lambda.hpp>
|
||||||
|
#include <boost/iterator.hpp>
|
||||||
|
|
||||||
|
#include "cpplinq/linq.hpp"
|
||||||
|
|
||||||
|
#include "testbench.hpp"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace cpplinq;
|
||||||
|
|
||||||
|
struct int_iter
|
||||||
|
: std::iterator<std::random_access_iterator_tag, int, std::ptrdiff_t, int*, int>
|
||||||
|
{
|
||||||
|
int_iter(value_type i = 0, value_type step = 1) : value(i), step(step)
|
||||||
|
{}
|
||||||
|
|
||||||
|
value_type operator*() const {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
int_iter& operator++() {
|
||||||
|
value+=step; return *this;
|
||||||
|
}
|
||||||
|
int_iter& operator--() {
|
||||||
|
value-=step; return *this;
|
||||||
|
}
|
||||||
|
int_iter& operator+=(std::ptrdiff_t offset) {
|
||||||
|
value += step*offset; return *this;
|
||||||
|
}
|
||||||
|
int_iter& operator-=(std::ptrdiff_t offset) {
|
||||||
|
value -= step*offset; return *this;
|
||||||
|
}
|
||||||
|
std::ptrdiff_t operator-(int_iter rhs) const {
|
||||||
|
return std::ptrdiff_t((value - rhs.value)/step);
|
||||||
|
}
|
||||||
|
bool operator==(int_iter other) const {
|
||||||
|
return value == other.value;
|
||||||
|
}
|
||||||
|
bool operator!=(int_iter other) const {
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
bool operator<(int_iter other) const { return (*this - other) < 0; }
|
||||||
|
bool operator>(int_iter other) const { return (*this - other) > 0; }
|
||||||
|
bool operator<=(int_iter other) const { return (*this - other) <= 0; }
|
||||||
|
bool operator>=(int_iter other) const { return (*this - other) >= 0; }
|
||||||
|
|
||||||
|
value_type value;
|
||||||
|
value_type step;
|
||||||
|
};
|
||||||
|
int_iter operator+(int_iter lhs, std::ptrdiff_t rhs) {
|
||||||
|
return lhs+=rhs;
|
||||||
|
}
|
||||||
|
int_iter operator+(std::ptrdiff_t lhs, int_iter rhs) {
|
||||||
|
return rhs+=lhs;
|
||||||
|
}
|
||||||
|
int_iter operator-(int_iter lhs, std::ptrdiff_t rhs) {
|
||||||
|
return lhs-=rhs;
|
||||||
|
}
|
||||||
|
struct int_range
|
||||||
|
{
|
||||||
|
typedef int_iter iterator;
|
||||||
|
typedef int_iter::value_type value_type;
|
||||||
|
int_range(value_type begin, value_type end, value_type step = 1)
|
||||||
|
: b(begin, step), e(end, step)
|
||||||
|
{
|
||||||
|
if (step == 0) {
|
||||||
|
throw std::logic_error("bad step");
|
||||||
|
}
|
||||||
|
if (abs(end - begin) % abs(step) != 0) {
|
||||||
|
end -= (end-begin)%abs(step);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int_iter begin() const { return int_iter(b);}
|
||||||
|
int_iter end() const { return int_iter(e); }
|
||||||
|
|
||||||
|
iterator b, e;
|
||||||
|
};
|
||||||
|
|
||||||
|
vector<int> vector_range(int start, int end)
|
||||||
|
{
|
||||||
|
vector<int> v;
|
||||||
|
for (int i = start; i < end; ++i)
|
||||||
|
v.push_back(i);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_selection)
|
||||||
|
{
|
||||||
|
vector<int> v = vector_range(0, 10);
|
||||||
|
|
||||||
|
auto v2 = from(v)
|
||||||
|
.select([](int x) { return x*2; });
|
||||||
|
|
||||||
|
auto result = accumulate(begin(v2), end(v2), int(0));
|
||||||
|
|
||||||
|
VERIFY_EQ(90, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_where)
|
||||||
|
{
|
||||||
|
vector<int> v = vector_range(0, 10);
|
||||||
|
auto v2 = from(v)
|
||||||
|
.where([](int x) { return x % 2;});
|
||||||
|
|
||||||
|
VERIFY_EQ(1, *v2.begin());
|
||||||
|
|
||||||
|
auto result = accumulate(begin(v2), end(v2), int(0));
|
||||||
|
|
||||||
|
VERIFY_EQ(25, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool is_prime(int x) {
|
||||||
|
if (x < 2) {return false;}
|
||||||
|
if (x == 2) {return true;}
|
||||||
|
for (int i = x/2; i >= 2; --i) {
|
||||||
|
if (x % i == 0) { return false;}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class It>
|
||||||
|
void display(It start, It end)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
for_each(start, end, [&](typename iterator_traits<It>::value_type x){
|
||||||
|
if (++i % 10 == 0) {
|
||||||
|
cout << endl;
|
||||||
|
}
|
||||||
|
cout << x << " ";
|
||||||
|
});
|
||||||
|
cout << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_whereselect)
|
||||||
|
{
|
||||||
|
auto xs = int_range(0,100);
|
||||||
|
auto ys = from(xs)
|
||||||
|
.where(is_prime)
|
||||||
|
.select([](int x){ return x*x; });
|
||||||
|
auto result = accumulate(begin(ys), end(ys), int(0));
|
||||||
|
|
||||||
|
//display(begin(ys), end(ys));
|
||||||
|
|
||||||
|
// primes < 100
|
||||||
|
VERIFY_EQ(65796, result);
|
||||||
|
}
|
||||||
|
TEST(test_where_modification)
|
||||||
|
{
|
||||||
|
vector<int> xs = vector_range(0, 100);
|
||||||
|
|
||||||
|
auto ys = from(xs)
|
||||||
|
.where(is_prime);
|
||||||
|
std::fill(begin(ys), end(ys), int(0));
|
||||||
|
|
||||||
|
auto result = accumulate(begin(xs), end(xs), int(0));
|
||||||
|
|
||||||
|
//display(begin(ys), end(ys));
|
||||||
|
|
||||||
|
// non-primes < 100
|
||||||
|
VERIFY_EQ(3890, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_where_any)
|
||||||
|
{
|
||||||
|
using namespace boost::lambda;
|
||||||
|
|
||||||
|
vector<int> xs(200);
|
||||||
|
fill(begin(xs), end(xs), int(0));
|
||||||
|
auto it = xs.begin();
|
||||||
|
*it = 2;
|
||||||
|
|
||||||
|
for(;;) {
|
||||||
|
auto last = *it++;
|
||||||
|
auto primes = from(int_range(last+1, -1))
|
||||||
|
.where([&](int x){
|
||||||
|
return from(begin(xs), it)
|
||||||
|
//.all([&](int d){return x%d;});
|
||||||
|
.all(x % boost::lambda::_1);
|
||||||
|
});
|
||||||
|
*it = *primes.begin();
|
||||||
|
if ((*it)>=100) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xs.erase(it, xs.end());
|
||||||
|
|
||||||
|
auto result = accumulate(begin(xs), end(xs), int(0));
|
||||||
|
|
||||||
|
//display(begin(xs), end(xs));
|
||||||
|
|
||||||
|
// primes < 100
|
||||||
|
VERIFY_EQ(1060, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_take)
|
||||||
|
{
|
||||||
|
auto zero_one = from(int_range(0, -1))
|
||||||
|
.take(2);
|
||||||
|
|
||||||
|
VERIFY_EQ(0, zero_one[0]);
|
||||||
|
VERIFY_EQ(1, zero_one[1]);
|
||||||
|
|
||||||
|
auto ten = from(int_range(0, -1))
|
||||||
|
.skip(10);
|
||||||
|
|
||||||
|
VERIFY_EQ(10, ten[0]);
|
||||||
|
VERIFY_EQ(11, ten[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<int> some_primes(std::size_t howMany)
|
||||||
|
{
|
||||||
|
auto xs = from(int_range(0, -1))
|
||||||
|
.where(is_prime)
|
||||||
|
.take(howMany);
|
||||||
|
auto v = vector<int>(begin(xs), end(xs));
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_groupby)
|
||||||
|
{
|
||||||
|
auto xs = some_primes(40);
|
||||||
|
//display(begin(xs), end(xs));
|
||||||
|
|
||||||
|
auto grouped =
|
||||||
|
from(xs)
|
||||||
|
.groupby([](int i){return i % 10; });
|
||||||
|
|
||||||
|
VERIFY_EQ(6, from(grouped).count());
|
||||||
|
for(auto group = begin(grouped); group != end(grouped); ++group) {
|
||||||
|
//cout << "key = " << group->key << endl
|
||||||
|
// << "| ";
|
||||||
|
for (auto elem = group->begin(); elem != group->end(); ++elem) {
|
||||||
|
//cout << *elem << " ";
|
||||||
|
}
|
||||||
|
//cout << endl;
|
||||||
|
|
||||||
|
switch(group->key) {
|
||||||
|
case 2: VERIFY_EQ(1, from(*group).count()); break;
|
||||||
|
case 3: VERIFY_EQ(11, from(*group).count()); break;
|
||||||
|
case 5: VERIFY_EQ(1, from(*group).count()); break;
|
||||||
|
case 7: VERIFY_EQ(11, from(*group).count()); break;
|
||||||
|
case 1: VERIFY_EQ(8, from(*group).count()); break;
|
||||||
|
case 9: VERIFY_EQ(8, from(*group).count()); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_symbolname)
|
||||||
|
{
|
||||||
|
auto complexQuery =
|
||||||
|
from(int_range(0,100000))
|
||||||
|
.select([](int x){ return x*2;})
|
||||||
|
.where([](int x){ return x%7; })
|
||||||
|
.skip(20);
|
||||||
|
|
||||||
|
//cout << " type name: " << typeid(complexQuery1).name() << endl;
|
||||||
|
|
||||||
|
|
||||||
|
//auto complexQuery =
|
||||||
|
// complexQuery1.groupby([](int x) { return x%5; })
|
||||||
|
// .take(3)
|
||||||
|
// ;
|
||||||
|
|
||||||
|
|
||||||
|
cout << "type name: " << typeid(complexQuery).name() << endl;
|
||||||
|
cout << "type name length: " << strlen(typeid(complexQuery).name()) << endl;
|
||||||
|
|
||||||
|
auto iter = complexQuery.begin();
|
||||||
|
cout << "iterator name: " << typeid(iter).name() << endl;
|
||||||
|
cout << "iterator name length: " << strlen(typeid(iter).name()) << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_cast)
|
||||||
|
{
|
||||||
|
auto q = from(int_range(0,10))
|
||||||
|
.cast<bool>();
|
||||||
|
VERIFY_EQ(false, q[0]);
|
||||||
|
VERIFY_EQ(true, q[1]);
|
||||||
|
VERIFY_EQ(true, q[2]);
|
||||||
|
VERIFY((std::is_same<decltype(q[0]), bool>::value));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_contains)
|
||||||
|
{
|
||||||
|
auto q = from(int_range(0,10))
|
||||||
|
.select([](int x){return x*2;});
|
||||||
|
VERIFY(q.contains(4));
|
||||||
|
VERIFY(!q.contains(5));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_element_accessors)
|
||||||
|
{
|
||||||
|
vector<int> v(int_iter(0), int_iter(10));
|
||||||
|
auto q = from(v)
|
||||||
|
.where([](int x){return x%2==0;});
|
||||||
|
|
||||||
|
VERIFY_EQ(0, q.first());
|
||||||
|
VERIFY_EQ(8, q.last());
|
||||||
|
VERIFY_EQ(6, q.element_at(3));
|
||||||
|
|
||||||
|
bool thrown = false;
|
||||||
|
try { q.element_at(5); } catch (std::logic_error&) { thrown = true; }
|
||||||
|
VERIFY(thrown);
|
||||||
|
|
||||||
|
q.first() = 1;
|
||||||
|
q.last() = 42;
|
||||||
|
|
||||||
|
// note: because the vector now contains { 1, 1, 2, 3, ... 7, 8, 42 }, the first
|
||||||
|
// even number is now '2'
|
||||||
|
VERIFY_EQ(2, q.first());
|
||||||
|
VERIFY_EQ(42, q.last());
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////// New style cursors ////////////////////
|
||||||
|
|
||||||
|
TEST(test_cursor_dynamic)
|
||||||
|
{
|
||||||
|
dynamic_cursor<int> dc(int_iter(0), int_iter(2));
|
||||||
|
|
||||||
|
VERIFY(!dc.empty());
|
||||||
|
VERIFY_EQ(0, dc.get());
|
||||||
|
dc.inc();
|
||||||
|
VERIFY_EQ(1, dc.get());
|
||||||
|
dc.inc();
|
||||||
|
VERIFY(dc.empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_selectmany)
|
||||||
|
{
|
||||||
|
int_range range1(0, 3);
|
||||||
|
auto range2 =
|
||||||
|
|
||||||
|
from(range1)
|
||||||
|
.select_many(
|
||||||
|
[](int x)
|
||||||
|
{
|
||||||
|
return int_range(0, x+1);
|
||||||
|
});
|
||||||
|
|
||||||
|
auto cur = range2.get_cursor();
|
||||||
|
|
||||||
|
// expected: 0, 0, 1, 0, 1, 2.
|
||||||
|
VERIFY(!cur.empty());
|
||||||
|
|
||||||
|
VERIFY_EQ(0, cur.get());
|
||||||
|
cur.inc();
|
||||||
|
VERIFY(!cur.empty());
|
||||||
|
|
||||||
|
VERIFY_EQ(0, cur.get());
|
||||||
|
cur.inc();
|
||||||
|
VERIFY(!cur.empty());
|
||||||
|
|
||||||
|
VERIFY_EQ(1, cur.get());
|
||||||
|
cur.inc();
|
||||||
|
VERIFY(!cur.empty());
|
||||||
|
|
||||||
|
VERIFY_EQ(0, cur.get());
|
||||||
|
cur.inc();
|
||||||
|
VERIFY(!cur.empty());
|
||||||
|
|
||||||
|
VERIFY_EQ(1, cur.get());
|
||||||
|
cur.inc();
|
||||||
|
VERIFY(!cur.empty());
|
||||||
|
|
||||||
|
VERIFY_EQ(2, cur.get());
|
||||||
|
cur.inc();
|
||||||
|
VERIFY(cur.empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_cursor_selectmany2)
|
||||||
|
{
|
||||||
|
int_range range1(0, 3);
|
||||||
|
auto range2 = from(range1)
|
||||||
|
.select_many(
|
||||||
|
[](int x)
|
||||||
|
{
|
||||||
|
return int_range(0, x+1);
|
||||||
|
});
|
||||||
|
|
||||||
|
// expected: 0, 0, 1, 0, 1, 2.
|
||||||
|
int expect[] = { 0, 0, 1, 0, 1, 2 };
|
||||||
|
|
||||||
|
VERIFY_EQ(_countof(expect), std::distance(range2.begin(), range2.end()));
|
||||||
|
VERIFY_EQ(_countof(expect), std::distance(range2.begin(), range2.end()));
|
||||||
|
|
||||||
|
auto result = std::mismatch(expect, expect + _countof(expect), range2.begin());
|
||||||
|
if (result.second != range2.end()) {
|
||||||
|
cout << "mismatch: " << *result.first << " != " << *result.second << endl;
|
||||||
|
}
|
||||||
|
VERIFY( result.second == range2.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_late_bind)
|
||||||
|
{
|
||||||
|
int_range range1(0, 100);
|
||||||
|
linq_driver<dynamic_collection<int>> range2 = from(range1).late_bind();
|
||||||
|
|
||||||
|
VERIFY_EQ(1, range2.element_at(1));
|
||||||
|
|
||||||
|
auto q1 = from(range1).select([](int x){ return x*2; }).where([](int x){ return x%10!=0; });
|
||||||
|
|
||||||
|
cout << "typeof q1 ==> " << typeid(q1).name() << endl;
|
||||||
|
cout << "typeof q1.late_bind() ==> " << typeid(q1.late_bind()).name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct stopwatch
|
||||||
|
{
|
||||||
|
time_t t0, t1;
|
||||||
|
void start() {
|
||||||
|
t1 = t0 = clock();
|
||||||
|
}
|
||||||
|
void stop() {
|
||||||
|
t1 = clock();
|
||||||
|
}
|
||||||
|
double value() const {
|
||||||
|
return double(t1-t0)/CLOCKS_PER_SEC;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class Fn>
|
||||||
|
void test_perf(Fn fn)
|
||||||
|
{
|
||||||
|
// warmup
|
||||||
|
fn(10);
|
||||||
|
|
||||||
|
int n = 100;
|
||||||
|
stopwatch sw;
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
cout << "trying n=" << n << endl;
|
||||||
|
sw.start();
|
||||||
|
fn(n);
|
||||||
|
sw.stop();
|
||||||
|
if (sw.value() > 2.0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
n *= 2;
|
||||||
|
}
|
||||||
|
cout << "time = " << sw.value() << " s\n";
|
||||||
|
cout << "steps = " << n << "\n";
|
||||||
|
cout << "t/step = " << (sw.value() * 1e9 / n) << " ns\n";
|
||||||
|
cout << "step/t = " << (n / sw.value()) << " Hz\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_performance)
|
||||||
|
{
|
||||||
|
// http://projecteuler.net/problem=8
|
||||||
|
//
|
||||||
|
// Find the greatest product of five consecutive digits in the 1000-digit number.
|
||||||
|
//
|
||||||
|
|
||||||
|
static const char num[] =
|
||||||
|
"73167176531330624919225119674426574742355349194934"
|
||||||
|
"96983520312774506326239578318016984801869478851843"
|
||||||
|
"85861560789112949495459501737958331952853208805511"
|
||||||
|
"12540698747158523863050715693290963295227443043557"
|
||||||
|
"66896648950445244523161731856403098711121722383113"
|
||||||
|
"62229893423380308135336276614282806444486645238749"
|
||||||
|
"30358907296290491560440772390713810515859307960866"
|
||||||
|
"70172427121883998797908792274921901699720888093776"
|
||||||
|
"65727333001053367881220235421809751254540594752243"
|
||||||
|
"52584907711670556013604839586446706324415722155397"
|
||||||
|
"53697817977846174064955149290862569321978468622482"
|
||||||
|
"83972241375657056057490261407972968652414535100474"
|
||||||
|
"82166370484403199890008895243450658541227588666881"
|
||||||
|
"16427171479924442928230863465674813919123162824586"
|
||||||
|
"17866458359124566529476545682848912883142607690042"
|
||||||
|
"24219022671055626321111109370544217506941658960408"
|
||||||
|
"07198403850962455444362981230987879927244284909188"
|
||||||
|
"84580156166097919133875499200524063689912560717606"
|
||||||
|
"05886116467109405077541002256983155200055935729725"
|
||||||
|
"71636269561882670428252483600823257530420752963450";
|
||||||
|
|
||||||
|
auto task = [&](int n){
|
||||||
|
for (int i = 0; i < n; ++i) {
|
||||||
|
auto range1 = int_range(0, _countof(num)-5); // 5 digit numbers, plus null terminator
|
||||||
|
|
||||||
|
auto products = from(range1)
|
||||||
|
.select([&](int i){ return num+i;})
|
||||||
|
.where([&](const char* s){ return !from(s, s+5).contains('0'); })
|
||||||
|
.select([&](const char* s) { return from(s, s+5).select([](char c){ return c - '0'; })
|
||||||
|
.aggregate(std::multiplies<int>()); });
|
||||||
|
|
||||||
|
auto result = products.max();
|
||||||
|
if (n == 1) {
|
||||||
|
cout << "result = " << result << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
cout << "length of input: " << (_countof(num)-1) << endl;
|
||||||
|
|
||||||
|
task(1);
|
||||||
|
cout << endl;
|
||||||
|
|
||||||
|
#ifdef PERF
|
||||||
|
test_perf(task);
|
||||||
|
cout << endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// SUM TESTS
|
||||||
|
|
||||||
|
TEST(test_sum_ints)
|
||||||
|
{
|
||||||
|
vector<int> numbers{1, 2, 3, 4, 5};
|
||||||
|
|
||||||
|
auto result = cpplinq::from(numbers);
|
||||||
|
auto r2 = result.sum();
|
||||||
|
|
||||||
|
VERIFY_EQ(15, r2);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_sum_ints_with_seed)
|
||||||
|
{
|
||||||
|
vector<int> numbers{1, 2, 3, 4, 5};
|
||||||
|
|
||||||
|
auto result = cpplinq::from(numbers).sum(10);
|
||||||
|
|
||||||
|
VERIFY_EQ(25, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_sum_floats) {
|
||||||
|
vector<float> numbers{ 1.0f,2.0f,3.0f,4.0f,5.0f };
|
||||||
|
|
||||||
|
auto result = cpplinq::from(numbers).sum();
|
||||||
|
|
||||||
|
VERIFY_EQ(15.0f, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_sum_doubles) {
|
||||||
|
vector<double> numbers { 1.0,2.0,3.0,4.0,5.0 };
|
||||||
|
|
||||||
|
auto result = cpplinq::from(numbers).sum();
|
||||||
|
|
||||||
|
VERIFY_EQ(15.0, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_sum_complex) {
|
||||||
|
using namespace std::complex_literals;
|
||||||
|
|
||||||
|
vector<complex<double>> numbers{ 1i, 1.0 + 2i, 2.0 + 3i };
|
||||||
|
|
||||||
|
auto sum = cpplinq::from(numbers).sum();
|
||||||
|
|
||||||
|
VERIFY_EQ(3.0, sum.real());
|
||||||
|
VERIFY_EQ(6.0, sum.imag());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_sum_with_projection_lambda) {
|
||||||
|
vector<tuple<int>> numbers { std::tuple<int>(0), std::tuple<int>(1), std::tuple<int>(2) };
|
||||||
|
|
||||||
|
auto result = cpplinq::from(numbers).sum([](std::tuple<int>& x){
|
||||||
|
return std::get<0>(x);
|
||||||
|
});
|
||||||
|
|
||||||
|
VERIFY_EQ(3.0, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_sum_with_projection_lambda_and_seed) {
|
||||||
|
vector<tuple<int>> numbers { std::tuple<int>(0), std::tuple<int>(1), std::tuple<int>(2) };
|
||||||
|
|
||||||
|
auto result = cpplinq::from(numbers).sum([](std::tuple<int>& x){
|
||||||
|
return std::get<0>(x);
|
||||||
|
}, 10);
|
||||||
|
|
||||||
|
VERIFY_EQ(13.0, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
int getValue(std::tuple<int> x)
|
||||||
|
{
|
||||||
|
return std::get<0>(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_sum_with_projection_function_pointer) {
|
||||||
|
vector<tuple<int>> numbers { std::tuple<int>(0), std::tuple<int>(1), std::tuple<int>(2) };
|
||||||
|
|
||||||
|
auto result = cpplinq::from(numbers).sum(getValue);
|
||||||
|
|
||||||
|
VERIFY_EQ(3.0, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
std::size_t pass = 0, fail = 0;
|
||||||
|
testrange<0,__LINE__>().run(pass, fail);
|
||||||
|
|
||||||
|
|
||||||
|
cout << "pass: " << pass << ", fail: " << fail << endl;
|
||||||
|
if (fail){
|
||||||
|
cerr << "ERRORS PRESENT." << endl;
|
||||||
|
} else if (!pass) {
|
||||||
|
cerr << "ERROR, no tests run" << endl;
|
||||||
|
}
|
||||||
|
}
|
88
3party/rxcpp/Ix/CPP/unittest/testbench.hpp
Normal file
88
3party/rxcpp/Ix/CPP/unittest/testbench.hpp
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <exception>
|
||||||
|
#include <sstream>
|
||||||
|
#include <utility>
|
||||||
|
#include <memory>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
struct empty_testcase{ void run(){} const char* name(){return 0;} };
|
||||||
|
|
||||||
|
template <std::size_t offset>
|
||||||
|
struct testcase : empty_testcase{};
|
||||||
|
|
||||||
|
|
||||||
|
template <std::size_t begin, std::size_t end>
|
||||||
|
struct testrange {
|
||||||
|
void run(std::size_t& pass, std::size_t& fail)
|
||||||
|
{
|
||||||
|
using namespace std;
|
||||||
|
{ testcase<begin> a_case;
|
||||||
|
if (a_case.name()) {
|
||||||
|
std::size_t p=0, f=0;
|
||||||
|
cout << "TEST: Running " << a_case.name() << endl;
|
||||||
|
try {
|
||||||
|
a_case.run();
|
||||||
|
++p;
|
||||||
|
} catch (logic_error& e) {
|
||||||
|
cerr << "ERRORS:" << endl;
|
||||||
|
cerr << " " << e.what() << endl;
|
||||||
|
++f;
|
||||||
|
}
|
||||||
|
pass += p; fail += f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const std::size_t rem = (end-begin-1);
|
||||||
|
testrange<begin+1, begin+1+rem/2>().run(pass, fail);
|
||||||
|
testrange<begin+1+rem/2, end>().run(pass, fail);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <std::size_t begin>
|
||||||
|
struct testrange<begin,begin> {
|
||||||
|
void run(std::size_t& pass, std::size_t& fail) {};
|
||||||
|
};
|
||||||
|
|
||||||
|
#define TEST(fun_name) \
|
||||||
|
void fun_name (); \
|
||||||
|
template <> \
|
||||||
|
struct testcase<__LINE__> { \
|
||||||
|
const char* name() { return(#fun_name); } \
|
||||||
|
void run() { fun_name(); } \
|
||||||
|
}; \
|
||||||
|
void fun_name()
|
||||||
|
|
||||||
|
#define Q_(e) #e
|
||||||
|
#define Q(e) Q_(e)
|
||||||
|
#define TASSERT(expr) \
|
||||||
|
{ auto e = (expr); if (!e) { throw std::logic_error(__FILE__ "(" Q(__LINE__) "): TASSERT("#expr")"); } }
|
||||||
|
|
||||||
|
struct errmsg
|
||||||
|
{
|
||||||
|
std::shared_ptr<std::stringstream> msg;
|
||||||
|
errmsg() : msg(new std::stringstream)
|
||||||
|
{}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
errmsg& operator<<(T value)
|
||||||
|
{
|
||||||
|
(*msg) << value;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
std::string str() { return msg->str(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
#define TEST_WHERE __FILE__ "(" Q(__LINE__) "): "
|
||||||
|
#define VERIFY(expr) \
|
||||||
|
{ auto e = (expr); if (!e) { throw std::logic_error(TEST_WHERE "VERIFY("#expr")"); } }
|
||||||
|
#define VERIFY_EQ(expected, actual) \
|
||||||
|
{ auto e = (expected); auto a = (actual); \
|
||||||
|
if (!(e == a)) { \
|
||||||
|
throw std::logic_error( \
|
||||||
|
(errmsg() << TEST_WHERE << "(" << e << ")!=(" << a << ") in VERIFY_EQ("#expected","#actual")").str() );}}
|
||||||
|
|
||||||
|
|
265
3party/rxcpp/README.md
Normal file
265
3party/rxcpp/README.md
Normal file
@ -0,0 +1,265 @@
|
|||||||
|
The Reactive Extensions for C++ (__RxCpp__) is a library of algorithms for values-distributed-in-time. The [__Range-v3__](https://github.com/ericniebler/range-v3) library does the same for values-distributed-in-space.
|
||||||
|
|
||||||
|
Platform | Status |
|
||||||
|
----------- | :------------ |
|
||||||
|
Windows | [![Windows Status](http://img.shields.io/appveyor/ci/kirkshoop/RxCpp-446.svg?style=flat-square)](https://ci.appveyor.com/project/kirkshoop/rxcpp-446)
|
||||||
|
Linux & OSX | [![Linux & Osx Status](http://img.shields.io/travis/ReactiveX/RxCpp.svg?style=flat-square)](https://travis-ci.org/ReactiveX/RxCpp)
|
||||||
|
|
||||||
|
Source | Badges |
|
||||||
|
------------- | :--------------- |
|
||||||
|
Github | [![GitHub license](https://img.shields.io/github/license/ReactiveX/RxCpp.svg?style=flat-square)](https://github.com/ReactiveX/RxCpp) <br/> [![GitHub release](https://img.shields.io/github/release/ReactiveX/RxCpp.svg?style=flat-square)](https://github.com/ReactiveX/RxCpp/releases) <br/> [![GitHub commits](https://img.shields.io/github/commits-since/ReactiveX/RxCpp/4.1.0.svg?style=flat-square)](https://github.com/ReactiveX/RxCpp)
|
||||||
|
Gitter.im | [![Join in on gitter.im](https://img.shields.io/gitter/room/Reactive-Extensions/RxCpp.svg?style=flat-square)](https://gitter.im/ReactiveX/RxCpp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
|
Packages | [![NuGet version](http://img.shields.io/nuget/v/RxCpp.svg?style=flat-square)](http://www.nuget.org/packages/RxCpp/) [![vcpkg port](https://img.shields.io/badge/vcpkg-port-blue.svg?style=flat-square)](https://github.com/Microsoft/vcpkg/tree/master/ports/rxcpp)
|
||||||
|
Documentation | [![rxcpp doxygen documentation](https://img.shields.io/badge/rxcpp-latest-brightgreen.svg?style=flat-square)](http://reactivex.github.io/RxCpp) <br/> [![reactivex intro](https://img.shields.io/badge/reactivex.io-intro-brightgreen.svg?style=flat-square)](http://reactivex.io/intro.html) [![rx marble diagrams](https://img.shields.io/badge/rxmarbles-diagrams-brightgreen.svg?style=flat-square)](http://rxmarbles.com/)
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
__RxCpp__ is a header-only C++ library that only depends on the standard library. The CMake build generates documentation and unit tests. The unit tests depend on a git submodule for the [Catch](https://github.com/philsquared/Catch) library.
|
||||||
|
|
||||||
|
# Example
|
||||||
|
Add `Rx/v2/src` to the include paths
|
||||||
|
|
||||||
|
[![lines from bytes](https://img.shields.io/badge/blog%20post-lines%20from%20bytes-blue.svg?style=flat-square)](http://kirkshoop.github.io/async/rxcpp/c++/2015/07/07/rxcpp_-_parsing_bytes_to_lines_of_text.html)
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
namespace Rx {
|
||||||
|
using namespace rxcpp;
|
||||||
|
using namespace rxcpp::sources;
|
||||||
|
using namespace rxcpp::operators;
|
||||||
|
using namespace rxcpp::util;
|
||||||
|
}
|
||||||
|
using namespace Rx;
|
||||||
|
|
||||||
|
#include <regex>
|
||||||
|
#include <random>
|
||||||
|
using namespace std;
|
||||||
|
using namespace std::chrono;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
random_device rd; // non-deterministic generator
|
||||||
|
mt19937 gen(rd());
|
||||||
|
uniform_int_distribution<> dist(4, 18);
|
||||||
|
|
||||||
|
// for testing purposes, produce byte stream that from lines of text
|
||||||
|
auto bytes = range(0, 10) |
|
||||||
|
flat_map([&](int i){
|
||||||
|
auto body = from((uint8_t)('A' + i)) |
|
||||||
|
repeat(dist(gen)) |
|
||||||
|
as_dynamic();
|
||||||
|
auto delim = from((uint8_t)'\r');
|
||||||
|
return from(body, delim) | concat();
|
||||||
|
}) |
|
||||||
|
window(17) |
|
||||||
|
flat_map([](observable<uint8_t> w){
|
||||||
|
return w |
|
||||||
|
reduce(
|
||||||
|
vector<uint8_t>(),
|
||||||
|
[](vector<uint8_t> v, uint8_t b){
|
||||||
|
v.push_back(b);
|
||||||
|
return v;
|
||||||
|
}) |
|
||||||
|
as_dynamic();
|
||||||
|
}) |
|
||||||
|
tap([](vector<uint8_t>& v){
|
||||||
|
// print input packet of bytes
|
||||||
|
copy(v.begin(), v.end(), ostream_iterator<long>(cout, " "));
|
||||||
|
cout << endl;
|
||||||
|
});
|
||||||
|
|
||||||
|
//
|
||||||
|
// recover lines of text from byte stream
|
||||||
|
//
|
||||||
|
|
||||||
|
auto removespaces = [](string s){
|
||||||
|
s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
|
||||||
|
return s;
|
||||||
|
};
|
||||||
|
|
||||||
|
// create strings split on \r
|
||||||
|
auto strings = bytes |
|
||||||
|
concat_map([](vector<uint8_t> v){
|
||||||
|
string s(v.begin(), v.end());
|
||||||
|
regex delim(R"/(\r)/");
|
||||||
|
cregex_token_iterator cursor(&s[0], &s[0] + s.size(), delim, {-1, 0});
|
||||||
|
cregex_token_iterator end;
|
||||||
|
vector<string> splits(cursor, end);
|
||||||
|
return iterate(move(splits));
|
||||||
|
}) |
|
||||||
|
filter([](const string& s){
|
||||||
|
return !s.empty();
|
||||||
|
}) |
|
||||||
|
publish() |
|
||||||
|
ref_count();
|
||||||
|
|
||||||
|
// filter to last string in each line
|
||||||
|
auto closes = strings |
|
||||||
|
filter(
|
||||||
|
[](const string& s){
|
||||||
|
return s.back() == '\r';
|
||||||
|
}) |
|
||||||
|
Rx::map([](const string&){return 0;});
|
||||||
|
|
||||||
|
// group strings by line
|
||||||
|
auto linewindows = strings |
|
||||||
|
window_toggle(closes | start_with(0), [=](int){return closes;});
|
||||||
|
|
||||||
|
// reduce the strings for a line into one string
|
||||||
|
auto lines = linewindows |
|
||||||
|
flat_map([&](observable<string> w) {
|
||||||
|
return w | start_with<string>("") | sum() | Rx::map(removespaces);
|
||||||
|
});
|
||||||
|
|
||||||
|
// print result
|
||||||
|
lines |
|
||||||
|
subscribe<string>(println(cout));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Reactive Extensions
|
||||||
|
|
||||||
|
>The ReactiveX Observable model allows you to treat streams of asynchronous events with the same sort of simple, composable operations that you use for collections of data items like arrays. It frees you from tangled webs of callbacks, and thereby makes your code more readable and less prone to bugs.
|
||||||
|
|
||||||
|
Credit [ReactiveX.io](http://reactivex.io/intro.html)
|
||||||
|
|
||||||
|
### Other language implementations
|
||||||
|
|
||||||
|
* Java: [RxJava](https://github.com/ReactiveX/RxJava)
|
||||||
|
* JavaScript: [rxjs](https://github.com/ReactiveX/rxjs)
|
||||||
|
* C#: [Rx.NET](https://github.com/Reactive-Extensions/Rx.NET)
|
||||||
|
* [More..](http://reactivex.io/languages.html)
|
||||||
|
|
||||||
|
### Resources
|
||||||
|
|
||||||
|
* [Intro](http://reactivex.io/intro.html)
|
||||||
|
* [Tutorials](http://reactivex.io/tutorials.html)
|
||||||
|
* [Marble Diagrams](http://rxmarbles.com/)
|
||||||
|
* [twitter stream analysis app](https://github.com/kirkshoop/twitter)
|
||||||
|
* [![baldwin pass to wilson](https://img.youtube.com/vi/QkvCzShHyVU/0.jpg)](https://www.youtube.com/watch?v=QkvCzShHyVU)
|
||||||
|
* _Algorithm Design For Values Distributed In Time_
|
||||||
|
* [![C++ Russia 2016](https://img.youtube.com/vi/Re6DS5Ff0uE/0.jpg)](https://www.youtube.com/watch?v=Re6DS5Ff0uE)
|
||||||
|
* [![CppCon 2016](https://img.youtube.com/vi/FcQURwM806o/0.jpg)](https://www.youtube.com/watch?v=FcQURwM806o)
|
||||||
|
|
||||||
|
# Cloning RxCpp
|
||||||
|
|
||||||
|
RxCpp uses a git submodule (in `ext/catch`) for the excellent [Catch](https://github.com/philsquared/Catch) library. The easiest way to ensure that the submodules are included in the clone is to add `--recursive` in the clone command.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git clone --recursive https://github.com/ReactiveX/RxCpp.git
|
||||||
|
cd RxCpp
|
||||||
|
```
|
||||||
|
|
||||||
|
# Installing
|
||||||
|
|
||||||
|
To install RxCpp into your OS you need to follow standart procedure:
|
||||||
|
```shell
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake ..
|
||||||
|
make install
|
||||||
|
```
|
||||||
|
|
||||||
|
If you're using the vcpkg dependency manager, you can install RxCpp using a single one-line command:
|
||||||
|
|
||||||
|
```
|
||||||
|
vcpkg install rxcpp
|
||||||
|
```
|
||||||
|
|
||||||
|
Vcpkg will acquire RxCpp, build it from source in your computer, and provide CMake integration support for your projects.
|
||||||
|
|
||||||
|
See the [vcpkg repository](https://github.com/Microsoft/vcpkg) for more information.
|
||||||
|
|
||||||
|
# Importing
|
||||||
|
|
||||||
|
After you have successfully installed RxCpp you can import it into any project by simply adding to your CMakeLists.txt:
|
||||||
|
```cmake
|
||||||
|
find_package(rxcpp CONFIG)
|
||||||
|
```
|
||||||
|
|
||||||
|
# Building RxCpp Unit Tests
|
||||||
|
|
||||||
|
* RxCpp is regularly tested on OSX and Windows.
|
||||||
|
* RxCpp is regularly built with Clang, Gcc and VC
|
||||||
|
* RxCpp depends on the latest compiler releases.
|
||||||
|
|
||||||
|
RxCpp uses CMake to create build files for several platforms and IDE's
|
||||||
|
|
||||||
|
### ide builds
|
||||||
|
|
||||||
|
#### XCode
|
||||||
|
```shell
|
||||||
|
mkdir projects/build
|
||||||
|
cd projects/build
|
||||||
|
cmake -G"Xcode" ../CMake -B.
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Visual Studio 2017
|
||||||
|
```batch
|
||||||
|
mkdir projects\build
|
||||||
|
cd projects\build
|
||||||
|
cmake -G "Visual Studio 15" ..\CMake\
|
||||||
|
msbuild Project.sln
|
||||||
|
```
|
||||||
|
|
||||||
|
### makefile builds
|
||||||
|
|
||||||
|
#### OSX
|
||||||
|
```shell
|
||||||
|
mkdir projects/build
|
||||||
|
cd projects/build
|
||||||
|
cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -B. ../CMake
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Linux --- Clang
|
||||||
|
```shell
|
||||||
|
mkdir projects/build
|
||||||
|
cd projects/build
|
||||||
|
cmake -G"Unix Makefiles" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXE_LINKER_FLAGS="-stdlib=libc++" -B. ../CMake
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Linux --- GCC
|
||||||
|
```shell
|
||||||
|
mkdir projects/build
|
||||||
|
cd projects/build
|
||||||
|
cmake -G"Unix Makefiles" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=RelWithDebInfo -B. ../CMake
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Windows
|
||||||
|
```batch
|
||||||
|
mkdir projects\build
|
||||||
|
cd projects\build
|
||||||
|
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -B. ..\CMake
|
||||||
|
nmake
|
||||||
|
```
|
||||||
|
|
||||||
|
The build only produces test and example binaries.
|
||||||
|
|
||||||
|
# Running tests
|
||||||
|
|
||||||
|
* You can use the CMake test runner `ctest`
|
||||||
|
* You can run the test binaries directly `rxcpp_test_*`
|
||||||
|
* Tests can be selected by name or tag
|
||||||
|
Example of by-tag
|
||||||
|
|
||||||
|
`rxcpp_test_subscription [perf]`
|
||||||
|
|
||||||
|
# Documentation
|
||||||
|
|
||||||
|
RxCpp uses Doxygen to generate project [documentation](http://reactivex.github.io/RxCpp).
|
||||||
|
|
||||||
|
When Doxygen+Graphviz is installed, CMake creates a special build task named `doc`. It creates actual documentation and puts it to `projects/doxygen/html/` folder, which can be published to the `gh-pages` branch. Each merged pull request will build the docs and publish them.
|
||||||
|
|
||||||
|
[Developers Material](DeveloperManual.md)
|
||||||
|
|
||||||
|
# Contributing Code
|
||||||
|
|
||||||
|
Before submitting a feature or substantial code contribution please discuss it with the team and ensure it follows the product roadmap. Note that all code submissions will be rigorously reviewed and tested by the Rx Team, and only those that meet an extremely high bar for both quality and design/roadmap appropriateness will be merged into the source.
|
||||||
|
|
||||||
|
# Microsoft Open Source Code of Conduct
|
||||||
|
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
308
3party/rxcpp/Readme.html
Normal file
308
3party/rxcpp/Readme.html
Normal file
@ -0,0 +1,308 @@
|
|||||||
|
<h1>Reactive Extensions</h1>
|
||||||
|
|
||||||
|
<p>Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators.</p>
|
||||||
|
<p>Data sequences can take many forms, such as a stream of data from a file or web service, web services requests, system notifications, or a series of events such as user input. </p>
|
||||||
|
<p>Reactive Extensions represents all these data sequences as observable sequences. An application can subscribe to these observable sequences to receive asynchronous notifications as new data arrives. The Rx library is available for application development in C++, .NET, Ruby, Python, Silverlight, Windows Phone 7 and JavaScript. For more information on these different platforms, see Differences Between Versions of Rx topic.</p>
|
||||||
|
|
||||||
|
<h2>Pulling vs. Pushing Data</h2>
|
||||||
|
<p>In interactive programming, the application actively polls a data source for more information by pulling data from a sequence that represents the source. The iterator allows us to get the current item by returning the current property, and determines whether there are more items to iterate (by calling some on_next method). </p>
|
||||||
|
<p>The application is active in the data retrieval process, controlling the pace of the retrieval by calling on_next at its own convenience. This pattern is synchronous, which means that the application might be blocked while polling the data source. Such pulling pattern is similar to visiting your library and checking out a book. After you are done with the book, you pay another visit to check out another one.</p>
|
||||||
|
<p>On the other hand, in reactive programming, the application is offered more information by subscribing to a data stream (called observable sequence in Rx), and any update is handed to it from the source. The application is passive in the data retrieval process: apart from subscribing to the observable source, it does not actively poll the source, but merely reacts to the data being pushed to it. When the stream has no more data to offer, or when it errs, the source will send a notice to the subscriber. In this way, the application will not be blocked by waiting for the source to update. </p>
|
||||||
|
<p>This is the push pattern employed by Reactive Extensions. It is similar to joining a book club in which you register your interest in a particular genre, and books that match your interest are automatically sent to you as they are published. You do not need to stand in line to acquire something that you want. Employing a push pattern is helpful in many scenarios, especially in a UI-heavy environment in which the UI thread cannot be blocked while the application is waiting for some events. In summary, by using Rx, you can make your application more responsive.</p>
|
||||||
|
<p>The push model implemented by Rx is represented by the observable pattern of Rx.Observable/Observer. The Rx.Observable will notify all the observers automatically of any state changes. To register an interest through a subscription, you use the subscribe method of Rx.Observable, which takes on an Observer and returns a disposable. This gives you the ability to track and dispose of the subscription. In addition, Rx’s LINQ implementation over observable sequences allows developers to compose complex event processing queries over push-based sequences such as events, APM-based (“AsyncResult”) computations, Task-based computations, and asynchronous workflows. For more information on the Observable/Observer classes, see Exploring The Major Classes in Rx. For tutorials on using the different features in Rx, see Using Rx.</p>
|
||||||
|
|
||||||
|
<h1>Getting Started with Rx</h1>
|
||||||
|
<p>This section describes in general what Reactive Extensions (Rx) is, and how it can benefit programmers who are creating asynchronous applications.</p>
|
||||||
|
|
||||||
|
<h3>In This Section</h3>
|
||||||
|
<p>1. When Will You Use Rx<br />
|
||||||
|
2. Installing Rx<br />
|
||||||
|
3. Differences Between Versions of Rx</p>
|
||||||
|
|
||||||
|
<h3>Related Sections</h3>
|
||||||
|
<p>Using Rx<br />
|
||||||
|
Reactive Extensions on MSDN Developer Center</p>
|
||||||
|
|
||||||
|
<h1>When Will You Use Rx</h1>
|
||||||
|
<p>This topic describes the advantage of using Rx for users who are currently using the .NET event model for asynchronous programming.</p>
|
||||||
|
|
||||||
|
<h2>Advantages of using Rx</h2>
|
||||||
|
<p>Whether you are authoring a traditional desktop or web-based application, you have to deal with asynchronous programming from time to time. Desktop applications have I/O or UI threads that might take a long time to complete and potentially block all other active threads. However, a user of the modern asynchronous programming model has to manage exceptions and cancellation of events manually. To compose or filter events, he has to write custom code that is hard to decipher and maintain.</p>
|
||||||
|
<p>In addition, if your application interacts with multiple sources of data, the conventional way to manage all of these interactions is to implement separate methods as event handlers for each of these data streams. For example, as soon as a user types a character, a keydown event is pushed to your keydown event handler method. Inside this keydown event handler, you have to provide code to react to this event, or to coordinate between all of the different data streams and process this data into a useable form.</p>
|
||||||
|
<p>Using Rx, you can represent multiple asynchronous data streams (that come from diverse sources, e.g., stock quote, tweets, computer events, web service requests, etc.), and subscribe to the event stream using the Observer class. The Observable class maintains a list of dependent Observer threads and notifies them automatically of any state changes. You can query observable sequences using standard LINQ query operators implemented by the Rx.Observable type. Thus you can filter, aggregate, and compose on multiple events easily by using these LINQ operators. Cancellation and exceptions can also be handled gracefully by using extension methods provided by Rx.</p>
|
||||||
|
<p>The following example shows how easy it is to implement an observable in C++.</p>
|
||||||
|
<pre><code>
|
||||||
|
auto ints = rxcpp::observable<>::create<int>(
|
||||||
|
[](rxcpp::subscriber<int> s){
|
||||||
|
s.on_next(1);
|
||||||
|
s.on_next(2);
|
||||||
|
s.on_completed();
|
||||||
|
});
|
||||||
|
|
||||||
|
ints.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
</code></pre>
|
||||||
|
<p>You can also use schedulers to control when the subscription starts, and when notifications are pushed to subscribers. For more information on this, see Using Schedulers for Concurrency Control.</p>
|
||||||
|
|
||||||
|
<h2>Filtering</h2>
|
||||||
|
<p>One drawback of the C++ event model is that your event handler is always called every time an event is raised, and events arrive exactly as they were sent out by the source. To filter out events that you are not interested in, or transform data before your handler is called, you have to add custom filter logic to your handler.</p>
|
||||||
|
<p>Take an application that detects mouse-down as an example. In the current event programming model, the application can react to the event raised by displaying a message. In Rx, such mouse-down events are treated as a stream of information about clicks. Whenever you click the mouse, information (e.g., cursor position) about this click appears in a stream, ready to be processed. In this paradigm, events (or event streams) are very similar to lists or other collections. This means that we can use techniques for working with collections to process events. For example, you can filter out those clicks that appear outside a specific area, and only display a message when the user clicks inside an area. Or you can wait a specific period of time, and inform the user the number of “valid” clicks during this period. Similarly, you can capture a stream of stock ticks and only respond to those ticks that have changed for a specific range during a particular time window. All these can be done easily by using LINQ-query style operators provided by Rx. </p>
|
||||||
|
<p>In this way, a function can take an event, process it, and then pass out the processed stream to an application. This gives you flexibility that is not available in the current programming model. Moreover, as Rx is performing all the plumbing work at the background for filtering, synchronizing, and transforming the data, your handler can just react to the data it receives and do something with it. This results in cleaner code that is easier to read and maintain. For more information on filtering, see Querying Observable Collections using LINQ Operators.</p>
|
||||||
|
|
||||||
|
<h2>Manipulating Events</h2>
|
||||||
|
<p>Rx represents events as a collection of objects: e.g., a OnMouseMove event contains a collection of Point values. Due to the first-class object nature of observables, they can be passed around as function parameters and returns, or stored in a variable.</p>
|
||||||
|
|
||||||
|
<h1>Installing Rx</h1>
|
||||||
|
<p>This topic describes where you can download the Reactive Extensions (Rx) SDK.</p>
|
||||||
|
|
||||||
|
<h2>To download Rx</h2>
|
||||||
|
<p>Reactive Extensions is available for different platforms such as C++, Javascript, .NET Framework 3.5, 4.0, 4.5, Silverlight 3 and 4, as well as Windows Phone 7 & 8. You can download the libraries, as well as learn about their prerequisites at the <a href="http://msdn.microsoft.com/en-us/data/gg577609" target="_blank">Rx MSDN Developer Center.</a></p>
|
||||||
|
|
||||||
|
<h1>Differences Between Versions of Rx</h1>
|
||||||
|
<p>The following topic describes the various platforms for which you can develop solutions using Reactive Extensions.</p>
|
||||||
|
<p>To get the latest release of Rx, as well as learn about its prerequisites, please visit the <a href="http://msdn.microsoft.com/en-us/data/gg577609" target="_blank">Rx MSDN Developer Center</a>. </p>
|
||||||
|
|
||||||
|
<h2>C++</h2>
|
||||||
|
<p>The Reactive Extensions for C++ (RxCpp) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in C++.</p>
|
||||||
|
|
||||||
|
<h2>Javascript</h2>
|
||||||
|
<p>Rx for Javascript (RxJS) allows you to use LINQ operators in JavaScript. It provides easy-to-use conversions from existing DOM, XmlHttpRequest (AJAX), and jQuery events to push-based observable collections, allowing users to seamlessly integrate Rx into their existing JavaScript-based websites. </p>
|
||||||
|
<p>RxJS brings similar capabilities to client script and integrates with jQuery events (Rx.Observable.FromJQueryEvent). It also supports Script#.</p>
|
||||||
|
|
||||||
|
<h2>Ruby</h2>
|
||||||
|
<p>Rx for Ruby (Rx.rb) allows you to use Linq operators to create push-based observable collections in Ruby.</p>
|
||||||
|
|
||||||
|
<h2>Python</h2>
|
||||||
|
<p>RX for Python (Rx.py) allows you to use Linq operators in Python. Rx.py allows you to implement push-based observable collections, allowing users to seamlessly integrate Rx into their existing Python applications.</p>
|
||||||
|
|
||||||
|
<h2>.NET Framework</h2>
|
||||||
|
<p>The core Rx interfaces, IObservable<T> and IObserver<T>, ship as part of .NET Framework 4. If you are running on .NET Framework 3.5 SP1, or if you want to take advantage of the LINQ operators implemented in Observable type, as well as many other features such as schedulers, you can download the Rx header-only library in the <a href="http://msdn.microsoft.com/en-us/data/gg577609" target="_blank">Rx MSDN Developer Center</a>.</p>
|
||||||
|
|
||||||
|
<h2>Silverlight </h2>
|
||||||
|
<p>Silverlight disallows you from making cross-threading calls, thus you cannot use a background thread to update the UI. Instead of writing verbose code using the Dispatcher.BeginInvoke call to explicitly execute code on the main UI thread, you can use the factory Observable.Start method provided by the Rx header-only library to invoke an action asynchronously. Cross-threading is taken care of transparently by Rx under the hood.</p>
|
||||||
|
<p>You can also use the various Observable operator overloads that take in a Scheduler, and specify the System.Reactive.Concurrency.DispatcherScheduler to be used.</p>
|
||||||
|
|
||||||
|
<h2>Windows Phone</h2>
|
||||||
|
<p>Windows Phone 7 ships with a version of the Reactive Extensions baked into the ROM of the device. For more information, see <a href="http://msdn.microsoft.com/en-us/library/ff431792(VS.92).aspx">Reactive Extensions for .NET Overview for Windows Phone</a>. Documentation for this version of the Reactive Extensions can be found in Windows Phone API library at <a href="http://msdn.microsoft.com/en-us/library/ff707857(v=VS.92).aspx">Microsoft.Phone.Reactive Namespace</a>. </p>
|
||||||
|
<p>The <a href="http://msdn.microsoft.com/en-us/data/gg577609" target="_blank">Rx MSDN Developer Center</a> also contains an updated version of Rx for WP7, which has new definitions in the System.Reactive.Linq namespace. Note that the new APIs will not clash with the library built in to the phone (nor do they replace the version in the ROM). For more information on the differences of these 2 versions, see this <a href="http://blogs.msdn.com/b/rxteam/archive/2010/10/28/rx-for-windows-phone-7.aspx">Rx team blog post</a>.</p>
|
||||||
|
<p>Rx is available for Windows Phone 8 as well as Windows Phone 7. A .NET portable library is available using Nuget that is useful for developing libraries that work on Windows Phone, Windows Store apps, and in classic Windows desktop or server applications.</p>
|
||||||
|
|
||||||
|
<h1>Using Rx</h1>
|
||||||
|
<p>This section includes topics that explain how you use Rx to create and subscribe to sequences, bridge existing events and existing asynchronous patterns, as well as using schedulers. It also describes more advanced tasks such as implementing your own operators.</p>
|
||||||
|
|
||||||
|
<h3>In This Section</h3>
|
||||||
|
<p>1. Exploring The Major Interfaces in Rx<br />
|
||||||
|
2. Creating and Querying Event Streams<br />
|
||||||
|
3. Subjects<br />
|
||||||
|
6. Implementing your own operators for IObservable<br />
|
||||||
|
7. Using Observable Providers</p>
|
||||||
|
|
||||||
|
<h1>Exploring The Major Interfaces in Rx</h1>
|
||||||
|
<p>This topic describes the major Reactive Extensions (Rx) interfaces used to represent observable sequences and subscribe to them. </p>
|
||||||
|
|
||||||
|
<h2>Observable/Observer</h2>
|
||||||
|
<p>Rx exposes asynchronous and event-based data sources as push-based, observable sequences. This Observable class represents a data source that can be observed, meaning that it can send data to anyone who is interested. It maintains a list of dependent Observer implementations representing such interested listeners, and notifies them automatically of any state changes.</p>
|
||||||
|
<p>As described in What is Rx, the other half of the push model is represented by the Observer class, which represents an observer who registers an interest through a subscription. Items are subsequently handed to the observer from the observable sequence to which it subscribes. </p>
|
||||||
|
<p>In order to receive notifications from an observable collection, you use the subscribe method of Observable to hand it an Observer object. In return for this observer, the subscribe method returns a disposable object that acts as a handle for the subscription. This allows you to clean up the subscription after you are done. Calling dispose on this object detaches the observer from the source so that notifications are no longer delivered. As you can infer, in Rx you do not need to explicitly unsubscribe from an event. </p>
|
||||||
|
<p>Observers support three publication events, reflected by the interface’s methods. OnNext can be called zero or more times, when the observable data source has data available. For example, an observable data source used for mouse move events can send out a Point object every time the mouse has moved. The other two methods are used to indicate completion or errors.</p>
|
||||||
|
<p>The following lists the Observable/Observer definitions.</p>
|
||||||
|
<pre><code>
|
||||||
|
namespace rxcpp {
|
||||||
|
template <class T>
|
||||||
|
struct subscriber
|
||||||
|
{
|
||||||
|
// observer<T>
|
||||||
|
void on_next(T);
|
||||||
|
void on_error(std::exception_ptr);
|
||||||
|
void on_completed();
|
||||||
|
|
||||||
|
// composite_subscription
|
||||||
|
bool is_subscribed();
|
||||||
|
void unsubscribe();
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct observable
|
||||||
|
{
|
||||||
|
composite_subscription subscribe(subscriber<T> out);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
</code></pre>
|
||||||
|
<p>Note that the OnError event returns an exception_ptr type. The example above shows passing the error to a handler function.</p>
|
||||||
|
<p>You can treat the observable sequence (such as a sequence of mouse-over events) as if it were a normal collection. Thus you can write LINQ queries over the collection to do things like filtering, grouping, composing, etc. To make observable sequences more useful, the Rx header-only library provides many factory LINQ operators so that you do not need to implement any of these on your own. This will be covered in the Querying Observable Collections using LINQ Operators topic.</p>
|
||||||
|
|
||||||
|
<h3>See Also</h3>
|
||||||
|
Creating and Subscribing to Simple Observable Sequences
|
||||||
|
Querying Observable Collections using LINQ Operators
|
||||||
|
|
||||||
|
<h1>Creating and Querying Observable Sequences</h1>
|
||||||
|
<p>This section describes how you can create and subscribe to an observable sequence, convert an existing C++ event into a sequence and query it. </p>
|
||||||
|
|
||||||
|
<h3>In This Section</h3>
|
||||||
|
<p>Creating and Subscribing to Simple Observable Sequences<br />
|
||||||
|
Querying Observable Collections using LINQ Operators</p>
|
||||||
|
|
||||||
|
<h1>Creating and Subscribing to Simple Observable Sequences</h1>
|
||||||
|
<p>You do not need to implement the Observable interface manually to create an observable sequences. Similarly, you do not need to implement Observer either to subscribe to a sequence. By installing the Reactive Extension header-only library, you can take advantage of the Observable type which provides many LINQ operators for you to create a simple sequence with zero, one or more elements. In addition, Rx provides Subscribe methods that take various combinations of OnNext, OnError and OnCompleted handlers in terms of delegates.</p>
|
||||||
|
|
||||||
|
<h2>Creating and subscribing to a simple sequence</h2>
|
||||||
|
<p>The following sample uses the range operator of the Observable type to create a simple observable collection of numbers. The observer subscribes to this collection using the Subscribe method of the Observable class, and provides actions that are delegates which handle OnNext, OnCompleted and OnError. </p>
|
||||||
|
<p>The range operator has several overloads. In our example, it creates a sequence of integers that starts with x and produces y sequential numbers afterwards. </p>
|
||||||
|
<p>As soon as the subscription happens, the values are sent to the observer. The OnNext delegate then prints out the values.</p>
|
||||||
|
<pre><code>
|
||||||
|
auto values1 = rxcpp::observable<>::range(1, 5);
|
||||||
|
values1.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
</code></pre>
|
||||||
|
<p>When an observer subscribes to an observable sequence, the thread calling the subscribe method can be different from the thread in which the sequence runs till completion. Therefore, the subscribe call is asynchronous in that the caller is not blocked until the observation of the sequence completes. This will be covered in more details in the Using Schedulers topic.</p>
|
||||||
|
<p>Notice that the subscribe method returns a Disposable, so that you can unsubscribe to a sequence and dispose of it easily. When you invoke the Dispose method on the observable sequence, the observer will stop listening to the observable for data. Normally, you do not need to explicitly call Dispose unless you need to unsubscribe early, or when the source observable sequence has a longer life span than the observer. Subscriptions in Rx are designed for fire-and-forget scenarios without the usage of a finalizer. When the Disposable instance is collected by the garbage collector, Rx does not automatically dispose of the subscription. However, note that the default behavior of the Observable operators is to dispose of the subscription as soon as possible (i.e, when an OnCompleted or OnError messages is published). </p>
|
||||||
|
<p>In addition to creating an observable sequence from scratch, you can convert existing enumerators, C++ events and asynchronous patterns into observable sequences. The other topics in this section will show you how to do this. </p>
|
||||||
|
<p>Notice that this topic only shows you a few operators that can create an observable sequence from scratch. To learn more about other LINQ operators, see Query Observable Collections using LINQ Operators.</p>
|
||||||
|
|
||||||
|
<h2>Converting an Enumerable Collection to an Observable Sequence</h2>
|
||||||
|
<p>Using the Iterate operator, you can convert an array colection to an observable sequence and subscribe to it. </p>
|
||||||
|
<pre><code>
|
||||||
|
std::array< int, 3 > a={{1, 2, 3}};
|
||||||
|
auto values1 = rxcpp::observable<>::iterate(a);
|
||||||
|
values1.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3>See Also</h3>
|
||||||
|
Query Observable Collections using LINQ Operators
|
||||||
|
|
||||||
|
<h1>Querying Observable Sequences using LINQ Operators</h1>
|
||||||
|
<p>We have converted existing C++ events into observable sequences to subscribe to them. In this topic, we will look at the first-class nature of observable sequences as Observable objects, in which generic LINQ operators are supplied by the Rx header-only library to manipulate these objects. Most operators take an observable sequence and perform some logic on it and output another observable sequence. In addition, as you can see from our code samples, you can even chain multiple operators on a source sequence to tweak the resulting sequence to your exact requirement. </p>
|
||||||
|
|
||||||
|
<h2>Using Different Operators</h2>
|
||||||
|
<p>We have already used the Create and Generate operators in previous topics to create and return simple sequences. In this topic, we will use other LINQ operators of the Observable type so that you can filter, group and transform data. Such operators take observable sequence(s) as input, and produce observable sequence(s) as output.</p>
|
||||||
|
|
||||||
|
<h2>Combining different sequences</h2>
|
||||||
|
<p>In this section, we will examine some of the operators that combine various observable sequences into a single observable sequence. Notice that data are not transformed when we combine sequences. </p>
|
||||||
|
<p>In the following sample, we use the concat operator to combine two sequences into a single sequence and subscribe to it. </p>
|
||||||
|
<pre><code>
|
||||||
|
auto values = rxcpp::observable<>::range(1); // infinite (until overflow) stream of integers
|
||||||
|
|
||||||
|
auto s1 = values.
|
||||||
|
take(3).
|
||||||
|
map([](int prime) { return std::make_tuple("1:", prime);});
|
||||||
|
|
||||||
|
auto s2 = values.
|
||||||
|
take(3).
|
||||||
|
map([](int prime) { return std::make_tuple("2:", prime);});
|
||||||
|
|
||||||
|
s1.
|
||||||
|
concat(s2).
|
||||||
|
subscribe(rxcpp::util::apply_to(
|
||||||
|
[](const char* s, int p) {
|
||||||
|
printf("%s %d\n", s, p);
|
||||||
|
}));
|
||||||
|
</code></pre>
|
||||||
|
<p>Notice that the resultant sequence is </p>
|
||||||
|
<pre>
|
||||||
|
1: 1
|
||||||
|
1: 2
|
||||||
|
1: 3
|
||||||
|
2: 1
|
||||||
|
2: 2
|
||||||
|
2: 3
|
||||||
|
</pre>
|
||||||
|
<p>This is because when you use the concat operator, the 2nd sequence (source2) will not be active until after the 1st sequence (source1) has finished pushing all its values. It is only after source1 has completed, then source2 will start to push values to the resultant sequence. The subscriber will then get all the values from the resultant sequence. </p>
|
||||||
|
<p>Compare this with the merge operator. If you run the following sample code, you will get </p>
|
||||||
|
<pre>
|
||||||
|
1: 1
|
||||||
|
2: 1
|
||||||
|
1: 2
|
||||||
|
2: 2
|
||||||
|
1: 3
|
||||||
|
2: 3
|
||||||
|
</pre>
|
||||||
|
<p>This is because the two sequences are active at the same time and values are pushed out as they occur in the sources. The resultant sequence only completes when the last source sequence has finished pushing values. </p>
|
||||||
|
<p>Notice that for Merge to work, all the source observable sequences need to be of the same type of Observable. The resultant sequence will be of the type Observable. If source1 produces an OnError in the middle of the sequence, then the resultant sequence will complete immediately.</p>
|
||||||
|
<pre><code>
|
||||||
|
auto values = rxcpp::observable<>::range(1); // infinite (until overflow) stream of integers
|
||||||
|
|
||||||
|
auto s1 = values.
|
||||||
|
map([](int prime) { return std::make_tuple("1:", prime);});
|
||||||
|
|
||||||
|
auto s2 = values.
|
||||||
|
map([](int prime) { return std::make_tuple("2:", prime);});
|
||||||
|
|
||||||
|
s1.
|
||||||
|
merge(s2).
|
||||||
|
take(6).
|
||||||
|
as_blocking().
|
||||||
|
subscribe(rxcpp::util::apply_to(
|
||||||
|
[](const char* s, int p) {
|
||||||
|
printf("%s %d\n", s, p);
|
||||||
|
}));
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h1>Subjects</h1>
|
||||||
|
<p>This section describes the Subject type implemented by Reactive Extensions. It also describes various implementations of Subject which serves different purposes. </p>
|
||||||
|
<h3>In This Section</h3>
|
||||||
|
<p>1. Using Subjects</p>
|
||||||
|
|
||||||
|
<h1>Using Subjects</h1>
|
||||||
|
<p>The Subject type implements both Observable and Observer, in the sense that it is both an observer and an observable. You can use a subject to subscribe all the observers, and then subscribe the subject to a backend data source. In this way, the subject can act as a proxy for a group of subscribers and a source. You can use subjects to implement a custom observable with caching, buffering and time shifting. In addition, you can use subjects to broadcast data to multiple subscribers. </p>
|
||||||
|
<p>By default, subjects do not perform any synchronization across threads. They do not take a scheduler but rather assume that all serialization and grammatical correctness are handled by the caller of the subject. A subject simply broadcasts to all subscribed observers in the thread-safe list of subscribers. Doing so has the advantage of reducing overhead and improving performance. If, however, you want to synchronize outgoing calls to observers using a scheduler, you can use the Synchronize method to do so.</p>
|
||||||
|
|
||||||
|
<h2>Different types of Subjects</h2>
|
||||||
|
<p>The Subject type in the Rx library is a basic implementation of the Subject interface (you can also implement the Subject interface to create your own subject types). There are other implementations of Subject that offer different functionalities. All of these types store some (or all of) values pushed to them via OnNext, and broadcast it back to its observers. This means that if you subscribe to any of these more than once (i.e. subscribe -> unsubscribe -> subscribe again), you will see at least one of the same value again. </p>
|
||||||
|
|
||||||
|
<h1>Scheduling and Concurrency</h1>
|
||||||
|
<p>This section describes how you can use a scheduler to control when to start a sequence or subscribe to an event. </p>
|
||||||
|
|
||||||
|
<h1>Scheduler Types</h1>
|
||||||
|
<p>The various Scheduler types provided by Rx are:</p>
|
||||||
|
<p>ImmediateScheduler: Default scheduler, pushes notifications as they are recieved.</p>
|
||||||
|
<p>EventLoopScheduler: Used when creating a separate thread for Rx sequences.</p>
|
||||||
|
|
||||||
|
<h1>Using Schedulers</h1>
|
||||||
|
<p>A scheduler controls when a subscription starts and when notifications are published. It consists of three components. It is first a data structure. When you schedule for tasks to be completed, they are put into the scheduler for queueing based on priority or other criteria. It also offers an execution context which denotes where the task is executed (e.g., in the thread pool, current thread, or in another app domain). Lastly, it has a clock which provides a notion of time for itself (by accessing the Now property of a scheduler). Tasks being scheduled on a particular scheduler will adhere to the time denoted by that clock only.</p>
|
||||||
|
|
||||||
|
<h2>Using Schedulers</h2>
|
||||||
|
<p>You may have already used schedulers in your Rx code without explicitly stating the type of schedulers to be used. This is because all Observable operators that deal with concurrency have multiple overloads. If you do not use the overload which takes a scheduler as an argument, Rx will pick a default scheduler by using the principle of least concurrency. This means that the scheduler which introduces the least amount of concurrency that satisfies the needs of the operator is chosen. For example, for operators returning an observable with a finite and small number of messages, Rx calls ImmediateScheduler. For operators returning a potentially large or infinite number of messages, CurrentThread is called.</p>
|
||||||
|
<p>In the following example, the source observable sequences are each running in their own threads using EventLoopScheduler.</p>
|
||||||
|
<pre><code>
|
||||||
|
auto threads = rxcpp::observe_on_event_loop();
|
||||||
|
|
||||||
|
auto values = rxcpp::observable<>::range(1); // infinite (until overflow) stream of integers
|
||||||
|
|
||||||
|
auto s1 = values.
|
||||||
|
subscribe_on(threads).
|
||||||
|
map([](int prime) { std::this_thread::yield(); return std::make_tuple("1:", prime);});
|
||||||
|
|
||||||
|
auto s2 = values.
|
||||||
|
subscribe_on(threads).
|
||||||
|
map([](int prime) { std::this_thread::yield(); return std::make_tuple("2:", prime);});
|
||||||
|
|
||||||
|
s1.
|
||||||
|
merge(s2).
|
||||||
|
take(6).
|
||||||
|
observe_on(threads).
|
||||||
|
as_blocking().
|
||||||
|
subscribe(rxcpp::util::apply_to(
|
||||||
|
[](const char* s, int p) {
|
||||||
|
printf("%s %d\n", s, p);
|
||||||
|
}));
|
||||||
|
</code></pre>
|
||||||
|
<p>This will queue up on the observer quickly. This code by uses the observe_on operator, which allows you to specify the context that you want to use to send pushed notifications (OnNext) to observers. By default, the observe_on operator ensures that OnNext will be called as many times as possible on the current thread. You can use its overloads and redirect the OnNext outputs to a different context. In addition, you can use the subscribe_on operator to return a proxy observable that delegates actions to a specific scheduler. For example, for a UI-intensive application, you can delegate all background operations to be performed on a scheduler running in the background by using subscribe_on and passing to it a Concurrency.EventLoopScheduler. </p>
|
||||||
|
<p>You should also note that by using the observe_on operator, an action is scheduled for each message that comes through the original observable sequence. This potentially changes timing information as well as puts additional stress on the system. If you have a query that composes various observable sequences running on many different execution contexts, and you are doing filtering in the query, it is best to place observe_on later in the query. This is because a query will potentially filter out a lot of messages, and placing the observe_on operator earlier in the query would do extra work on messages that would be filtered out anyway. Calling the observe_on operator at the end of the query will create the least performance impact.</p>
|
||||||
|
|
||||||
|
<h1>Implementing Your Own Operators for Observable</h1>
|
||||||
|
<p>You can extend Rx by adding new operators for operations that are not provided by the LINQ library, or by creating your own implementation of standard query operators to improve readability and performance. Writing a customized version of a standard LINQ operator is useful when you want to operate with in-memory objects and when the intended customization does not require a comprehensive view of the query.</p>
|
||||||
|
|
||||||
|
<h2>Creating New Operators</h2>
|
||||||
|
<p>LINQ offers a full set of operators that cover most of the possible operations on a set of entities. However, you might need an operator to add a particular semantic meaning to your query—especially if you can reuse that same operator several times in your code. </p>
|
||||||
|
<p>By reusing existing LINQ operators when you build a new one, you can take advantage of the existing performance or exception handling capabilities implemented in the Rx libraries.</p>
|
||||||
|
<p>When writing a custom operator, it is good practice not to leave any disposables unused; otherwise, you may find that resources could actually be leaked and cancellation may not work correctly.</p>
|
||||||
|
|
||||||
|
<h2>Customizing Existing Operators</h2>
|
||||||
|
<p>Adding new operators to LINQ is a way to extend its capabilities. However, you can also improve code readability by wrapping existing operators into more specialized and meaningful ones.</p>
|
36
3party/rxcpp/Rx/v2/examples/awaitable/CMakeLists.txt
Normal file
36
3party/rxcpp/Rx/v2/examples/awaitable/CMakeLists.txt
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
|
||||||
|
|
||||||
|
get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
|
||||||
|
|
||||||
|
project(${SAMPLE_PROJECT} LANGUAGES C CXX)
|
||||||
|
|
||||||
|
# define some folders
|
||||||
|
get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
|
||||||
|
get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
|
||||||
|
get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
|
||||||
|
get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
|
||||||
|
|
||||||
|
MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
|
||||||
|
|
||||||
|
include(${RXCPP_DIR}/projects/CMake/shared.cmake)
|
||||||
|
|
||||||
|
# define the sources
|
||||||
|
set(SAMPLE_SOURCES
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
|
||||||
|
)
|
||||||
|
add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES})
|
||||||
|
add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT})
|
||||||
|
target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS} /await)
|
||||||
|
target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES})
|
||||||
|
target_include_directories(${SAMPLE_PROJECT} PUBLIC ${RX_SRC_DIR})
|
||||||
|
target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
|
||||||
|
# configure unit tests via CTest
|
||||||
|
enable_testing()
|
||||||
|
set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
|
||||||
|
|
||||||
|
set_target_properties(${SAMPLE_PROJECT} PROPERTIES FOLDER "Examples")
|
||||||
|
|
||||||
|
add_test(NAME RunTests
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
|
COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS})
|
58
3party/rxcpp/Rx/v2/examples/awaitable/main.cpp
Normal file
58
3party/rxcpp/Rx/v2/examples/awaitable/main.cpp
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
|
||||||
|
#include <rxcpp/rx-lite.hpp>
|
||||||
|
#include <rxcpp/operators/rx-take.hpp>
|
||||||
|
|
||||||
|
#include <rxcpp/rx-coroutine.hpp>
|
||||||
|
|
||||||
|
using namespace rxcpp;
|
||||||
|
using namespace rxcpp::sources;
|
||||||
|
using namespace rxcpp::operators;
|
||||||
|
using namespace rxcpp::util;
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace std::chrono;
|
||||||
|
|
||||||
|
future<void> intervals(){
|
||||||
|
|
||||||
|
{
|
||||||
|
printf("early exit from interval on thread\n");
|
||||||
|
for co_await (auto c : interval(seconds(1), observe_on_event_loop())) {
|
||||||
|
printf("%d\n", c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
printf("interval on thread\n");
|
||||||
|
for co_await (auto c : interval(seconds(1), observe_on_event_loop()) | take(3)) {
|
||||||
|
printf("%d\n", c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
printf("current thread\n");
|
||||||
|
int last = 0;
|
||||||
|
for co_await (auto c : range(1, 100000)) {
|
||||||
|
last = c;
|
||||||
|
}
|
||||||
|
printf("reached %d\n", last);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
printf("error in observable\n");
|
||||||
|
for co_await (auto c : error<long>(runtime_error("stopped by error"))) {
|
||||||
|
printf("%d\n", c);
|
||||||
|
}
|
||||||
|
printf("not reachable\n");
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
catch(const exception& e) {
|
||||||
|
printf("%s\n", e.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
intervals().get();
|
||||||
|
return 0;
|
||||||
|
}
|
38
3party/rxcpp/Rx/v2/examples/cep/CMakeLists.txt
Normal file
38
3party/rxcpp/Rx/v2/examples/cep/CMakeLists.txt
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
|
||||||
|
|
||||||
|
get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
|
||||||
|
|
||||||
|
project(${SAMPLE_PROJECT} LANGUAGES C CXX)
|
||||||
|
|
||||||
|
# define some folders
|
||||||
|
get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
|
||||||
|
get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
|
||||||
|
get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
|
||||||
|
get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
|
||||||
|
|
||||||
|
MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
|
||||||
|
|
||||||
|
include(${RXCPP_DIR}/projects/CMake/shared.cmake)
|
||||||
|
|
||||||
|
# define the sources
|
||||||
|
set(SAMPLE_SOURCES
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
|
||||||
|
)
|
||||||
|
add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES})
|
||||||
|
add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT})
|
||||||
|
target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS})
|
||||||
|
target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES})
|
||||||
|
target_include_directories(${SAMPLE_PROJECT}
|
||||||
|
PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR}
|
||||||
|
)
|
||||||
|
target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
|
||||||
|
# configure unit tests via CTest
|
||||||
|
enable_testing()
|
||||||
|
set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
|
||||||
|
|
||||||
|
set_target_properties(${SAMPLE_PROJECT} PROPERTIES FOLDER "Examples")
|
||||||
|
|
||||||
|
add_test(NAME RunTests
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
|
COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS})
|
43
3party/rxcpp/Rx/v2/examples/cep/main.cpp
Normal file
43
3party/rxcpp/Rx/v2/examples/cep/main.cpp
Normal file
@ -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 <cctype>
|
||||||
|
#include <clocale>
|
||||||
|
|
||||||
|
// At this time, RxCpp will fail to compile if the contents
|
||||||
|
// of the std namespace are merged into the global namespace
|
||||||
|
// DO NOT USE: 'using namespace std;'
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
auto keys = rx::observable<>::create<int>(
|
||||||
|
[](rx::subscriber<int> dest){
|
||||||
|
for (;;) {
|
||||||
|
int key = std::cin.get();
|
||||||
|
dest.on_next(key);
|
||||||
|
}
|
||||||
|
}).
|
||||||
|
publish();
|
||||||
|
|
||||||
|
auto a = keys.
|
||||||
|
filter([](int key){return std::tolower(key) == 'a';});
|
||||||
|
|
||||||
|
auto g = keys.
|
||||||
|
filter([](int key){return std::tolower(key) == 'g';});
|
||||||
|
|
||||||
|
a.merge(g).
|
||||||
|
subscribe([](int key){
|
||||||
|
std::cout << key << std::endl;
|
||||||
|
});
|
||||||
|
|
||||||
|
// run the loop in create
|
||||||
|
keys.connect();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
32
3party/rxcpp/Rx/v2/examples/doxygen/CMakeLists.txt
Normal file
32
3party/rxcpp/Rx/v2/examples/doxygen/CMakeLists.txt
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
|
||||||
|
|
||||||
|
get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
|
||||||
|
|
||||||
|
project(${SAMPLE_PROJECT} LANGUAGES C CXX)
|
||||||
|
|
||||||
|
# define some folders
|
||||||
|
get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
|
||||||
|
get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
|
||||||
|
get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
|
||||||
|
get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
|
||||||
|
|
||||||
|
MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
|
||||||
|
|
||||||
|
include(${RXCPP_DIR}/projects/CMake/shared.cmake)
|
||||||
|
|
||||||
|
# define the sources
|
||||||
|
file(GLOB SAMPLE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
|
||||||
|
add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES})
|
||||||
|
add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT})
|
||||||
|
target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS})
|
||||||
|
target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES})
|
||||||
|
target_include_directories(${SAMPLE_PROJECT} PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR})
|
||||||
|
target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
|
||||||
|
# configure unit tests via CTest
|
||||||
|
enable_testing()
|
||||||
|
set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
|
||||||
|
|
||||||
|
add_test(NAME RunTests
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
|
COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS})
|
29
3party/rxcpp/Rx/v2/examples/doxygen/all.cpp
Normal file
29
3party/rxcpp/Rx/v2/examples/doxygen/all.cpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("all sample") {
|
||||||
|
printf("//! [all sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::from(1, 2, 3, 4, 5).all([](int n) { return n < 6; });
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
|
||||||
|
[]() { printf("OnCompleted\n"); });
|
||||||
|
printf("//! [all sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("all - operator syntax sample") {
|
||||||
|
using namespace rxcpp;
|
||||||
|
using namespace rxcpp::sources;
|
||||||
|
using namespace rxcpp::operators;
|
||||||
|
|
||||||
|
printf("//! [all - operator syntax sample]\n");
|
||||||
|
auto values = range(1, 10)
|
||||||
|
| all([](int n) { return n < 100; });
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
|
||||||
|
[]() { printf("OnCompleted\n"); });
|
||||||
|
printf("//! [all - operator syntax sample]\n");
|
||||||
|
}
|
84
3party/rxcpp/Rx/v2/examples/doxygen/amb.cpp
Normal file
84
3party/rxcpp/Rx/v2/examples/doxygen/amb.cpp
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("amb sample"){
|
||||||
|
printf("//! [amb sample]\n");
|
||||||
|
auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(15)).map([](int) {return 1;});
|
||||||
|
auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](int) {return 2;});
|
||||||
|
auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {return 3;});
|
||||||
|
auto values = o1.amb(o2, o3);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [amb sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("implicit amb sample"){
|
||||||
|
printf("//! [implicit amb sample]\n");
|
||||||
|
auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(15)).map([](int) {return 1;});
|
||||||
|
auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](int) {return 2;});
|
||||||
|
auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {return 3;});
|
||||||
|
auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
|
||||||
|
auto values = base.amb();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [implicit amb sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "main.hpp"
|
||||||
|
|
||||||
|
SCENARIO("threaded amb sample"){
|
||||||
|
printf("//! [threaded amb sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(15)).map([](int) {
|
||||||
|
printf("[thread %s] Timer1 fired\n", get_pid().c_str());
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](int) {
|
||||||
|
printf("[thread %s] Timer2 fired\n", get_pid().c_str());
|
||||||
|
return 2;
|
||||||
|
});
|
||||||
|
auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {
|
||||||
|
printf("[thread %s] Timer3 fired\n", get_pid().c_str());
|
||||||
|
return 3;
|
||||||
|
});
|
||||||
|
auto values = o1.amb(rxcpp::observe_on_new_thread(), o2, o3);
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("[thread %s] OnNext: %d\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [threaded amb sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded implicit amb sample"){
|
||||||
|
printf("//! [threaded implicit amb sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(15)).map([](int) {
|
||||||
|
printf("[thread %s] Timer1 fired\n", get_pid().c_str());
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](int) {
|
||||||
|
printf("[thread %s] Timer2 fired\n", get_pid().c_str());
|
||||||
|
return 2;
|
||||||
|
});
|
||||||
|
auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {
|
||||||
|
printf("[thread %s] Timer3 fired\n", get_pid().c_str());
|
||||||
|
return 3;
|
||||||
|
});
|
||||||
|
auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
|
||||||
|
auto values = base.amb(rxcpp::observe_on_new_thread());
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("[thread %s] OnNext: %d\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [threaded implicit amb sample]\n");
|
||||||
|
}
|
29
3party/rxcpp/Rx/v2/examples/doxygen/any.cpp
Normal file
29
3party/rxcpp/Rx/v2/examples/doxygen/any.cpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("any sample") {
|
||||||
|
printf("//! [any sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::from(1, 2, 3, 4, 5).any([](int n) { return n > 3; });
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
|
||||||
|
[]() { printf("OnCompleted\n"); });
|
||||||
|
printf("//! [any sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("any - operator syntax sample") {
|
||||||
|
using namespace rxcpp;
|
||||||
|
using namespace rxcpp::sources;
|
||||||
|
using namespace rxcpp::operators;
|
||||||
|
|
||||||
|
printf("//! [any - operator syntax sample]\n");
|
||||||
|
auto values = range(1, 10)
|
||||||
|
| any([](int n) { return n == 1; });
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
|
||||||
|
[]() { printf("OnCompleted\n"); });
|
||||||
|
printf("//! [any - operator syntax sample]\n");
|
||||||
|
}
|
21
3party/rxcpp/Rx/v2/examples/doxygen/as_dynamic.cpp
Normal file
21
3party/rxcpp/Rx/v2/examples/doxygen/as_dynamic.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("as_dynamic sample"){
|
||||||
|
printf("//! [as_dynamic sample]\n");
|
||||||
|
auto o1 = rxcpp::observable<>::range(1, 3);
|
||||||
|
auto o2 = rxcpp::observable<>::just(4);
|
||||||
|
auto o3 = rxcpp::observable<>::empty<int>();
|
||||||
|
auto values = o1.concat(o2, o3);
|
||||||
|
printf("type of o1: %s\n", typeid(o1).name());
|
||||||
|
printf("type of o1.as_dynamic(): %s\n", typeid(o1.as_dynamic()).name());
|
||||||
|
printf("type of o2: %s\n", typeid(o2).name());
|
||||||
|
printf("type of o2.as_dynamic(): %s\n", typeid(o2.as_dynamic()).name());
|
||||||
|
printf("type of o3: %s\n", typeid(o3).name());
|
||||||
|
printf("type of o3.as_dynamic(): %s\n", typeid(o3.as_dynamic()).name());
|
||||||
|
printf("type of values: %s\n", typeid(values).name());
|
||||||
|
printf("type of values.as_dynamic(): %s\n", typeid(values.as_dynamic()).name());
|
||||||
|
printf("//! [as_dynamic sample]\n");
|
||||||
|
}
|
229
3party/rxcpp/Rx/v2/examples/doxygen/blocking_observable.cpp
Normal file
229
3party/rxcpp/Rx/v2/examples/doxygen/blocking_observable.cpp
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("blocking first sample"){
|
||||||
|
printf("//! [blocking first sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).as_blocking();
|
||||||
|
auto first = values.first();
|
||||||
|
printf("first = %d\n", first);
|
||||||
|
printf("//! [blocking first sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking first empty sample"){
|
||||||
|
printf("//! [blocking first empty sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::empty<int>().as_blocking();
|
||||||
|
try {
|
||||||
|
auto first = values.first();
|
||||||
|
printf("first = %d\n", first);
|
||||||
|
} catch (const rxcpp::empty_error& ex) {
|
||||||
|
printf("Exception: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
printf("//! [blocking first empty sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking first error sample"){
|
||||||
|
printf("//! [blocking first error sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::error<int>(std::runtime_error("Error from source")).
|
||||||
|
as_blocking();
|
||||||
|
try {
|
||||||
|
auto first = values.first();
|
||||||
|
printf("first = %d\n", first);
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
printf("Exception: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
printf("//! [blocking first error sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking last sample"){
|
||||||
|
printf("//! [blocking last sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).as_blocking();
|
||||||
|
auto last = values.last();
|
||||||
|
printf("last = %d\n", last);
|
||||||
|
printf("//! [blocking last sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking last empty sample"){
|
||||||
|
printf("//! [blocking last empty sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::empty<int>().as_blocking();
|
||||||
|
try {
|
||||||
|
auto last = values.last();
|
||||||
|
printf("last = %d\n", last);
|
||||||
|
} catch (const rxcpp::empty_error& ex) {
|
||||||
|
printf("Exception: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
printf("//! [blocking last empty sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking last error sample"){
|
||||||
|
printf("//! [blocking last error sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
|
||||||
|
as_blocking();
|
||||||
|
try {
|
||||||
|
auto last = values.last();
|
||||||
|
printf("last = %d\n", last);
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
printf("Exception: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
printf("//! [blocking last error sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking count sample"){
|
||||||
|
printf("//! [blocking count sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).as_blocking();
|
||||||
|
auto count = values.count();
|
||||||
|
printf("count = %d\n", count);
|
||||||
|
printf("//! [blocking count sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking count error sample"){
|
||||||
|
printf("//! [blocking count error sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
|
||||||
|
as_blocking();
|
||||||
|
try {
|
||||||
|
auto count = values.count();
|
||||||
|
printf("count = %d\n", count);
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
printf("Exception: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
printf("//! [blocking count error sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking sum sample"){
|
||||||
|
printf("//! [blocking sum sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).as_blocking();
|
||||||
|
auto sum = values.sum();
|
||||||
|
printf("sum = %d\n", sum);
|
||||||
|
printf("//! [blocking sum sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking sum empty sample"){
|
||||||
|
printf("//! [blocking sum empty sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::empty<int>().as_blocking();
|
||||||
|
try {
|
||||||
|
auto sum = values.sum();
|
||||||
|
printf("sum = %d\n", sum);
|
||||||
|
} catch (const rxcpp::empty_error& ex) {
|
||||||
|
printf("Exception: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
printf("//! [blocking sum empty sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking sum error sample"){
|
||||||
|
printf("//! [blocking sum error sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
|
||||||
|
as_blocking();
|
||||||
|
try {
|
||||||
|
auto sum = values.sum();
|
||||||
|
printf("sum = %d\n", sum);
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
printf("Exception: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
printf("//! [blocking sum error sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking average sample"){
|
||||||
|
printf("//! [blocking average sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 4).as_blocking();
|
||||||
|
auto average = values.average();
|
||||||
|
printf("average = %lf\n", average);
|
||||||
|
printf("//! [blocking average sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking average empty sample"){
|
||||||
|
printf("//! [blocking average empty sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::empty<int>().as_blocking();
|
||||||
|
try {
|
||||||
|
auto average = values.average();
|
||||||
|
printf("average = %lf\n", average);
|
||||||
|
} catch (const rxcpp::empty_error& ex) {
|
||||||
|
printf("Exception: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
printf("//! [blocking average empty sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking average error sample"){
|
||||||
|
printf("//! [blocking average error sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 4).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
|
||||||
|
as_blocking();
|
||||||
|
try {
|
||||||
|
auto average = values.average();
|
||||||
|
printf("average = %lf\n", average);
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
printf("Exception: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
printf("//! [blocking average error sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking max sample"){
|
||||||
|
printf("//! [blocking max sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 4).as_blocking();
|
||||||
|
auto max = values.max();
|
||||||
|
printf("max = %d\n", max);
|
||||||
|
printf("//! [blocking max sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking max empty sample"){
|
||||||
|
printf("//! [blocking max empty sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::empty<int>().as_blocking();
|
||||||
|
try {
|
||||||
|
auto max = values.max();
|
||||||
|
printf("max = %d\n", max);
|
||||||
|
} catch (const rxcpp::empty_error& ex) {
|
||||||
|
printf("Exception: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
printf("//! [blocking max empty sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking max error sample"){
|
||||||
|
printf("//! [blocking max error sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 4).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
|
||||||
|
as_blocking();
|
||||||
|
try {
|
||||||
|
auto max = values.max();
|
||||||
|
printf("max = %d\n", max);
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
printf("Exception: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
printf("//! [blocking max error sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking min sample"){
|
||||||
|
printf("//! [blocking min sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 4).as_blocking();
|
||||||
|
auto min = values.min();
|
||||||
|
printf("min = %d\n", min);
|
||||||
|
printf("//! [blocking min sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking min empty sample"){
|
||||||
|
printf("//! [blocking min empty sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::empty<int>().as_blocking();
|
||||||
|
try {
|
||||||
|
auto min = values.min();
|
||||||
|
printf("min = %d\n", min);
|
||||||
|
} catch (const rxcpp::empty_error& ex) {
|
||||||
|
printf("Exception: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
printf("//! [blocking min empty sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("blocking min error sample"){
|
||||||
|
printf("//! [blocking min error sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 4).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
|
||||||
|
as_blocking();
|
||||||
|
try {
|
||||||
|
auto min = values.min();
|
||||||
|
printf("min = %d\n", min);
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
printf("Exception: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
printf("//! [blocking min error sample]\n");
|
||||||
|
}
|
202
3party/rxcpp/Rx/v2/examples/doxygen/buffer.cpp
Normal file
202
3party/rxcpp/Rx/v2/examples/doxygen/buffer.cpp
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("buffer count sample"){
|
||||||
|
printf("//! [buffer count sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 5).buffer(2);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](std::vector<int> v){
|
||||||
|
printf("OnNext:");
|
||||||
|
std::for_each(v.begin(), v.end(), [](int a){
|
||||||
|
printf(" %d", a);
|
||||||
|
});
|
||||||
|
printf("\n");
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [buffer count sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("buffer count+skip sample"){
|
||||||
|
printf("//! [buffer count+skip sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 7).buffer(2, 3);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](std::vector<int> v){
|
||||||
|
printf("OnNext:");
|
||||||
|
std::for_each(v.begin(), v.end(), [](int a){
|
||||||
|
printf(" %d", a);
|
||||||
|
});
|
||||||
|
printf("\n");
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [buffer count+skip sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "main.hpp"
|
||||||
|
|
||||||
|
SCENARIO("buffer period+skip+coordination sample"){
|
||||||
|
printf("//! [buffer period+skip+coordination sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto period = std::chrono::milliseconds(4);
|
||||||
|
auto skip = std::chrono::milliseconds(6);
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(1), std::chrono::milliseconds(2)).
|
||||||
|
map([](long v){
|
||||||
|
printf("[thread %s] Interval OnNext: %ld\n", get_pid().c_str(), v);
|
||||||
|
return v;
|
||||||
|
}).
|
||||||
|
take(7).
|
||||||
|
buffer_with_time(period, skip, rxcpp::observe_on_new_thread());
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](std::vector<long> v){
|
||||||
|
printf("[thread %s] OnNext:", get_pid().c_str());
|
||||||
|
std::for_each(v.begin(), v.end(), [](long a){
|
||||||
|
printf(" %ld", a);
|
||||||
|
});
|
||||||
|
printf("\n");
|
||||||
|
},
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [buffer period+skip+coordination sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("buffer period+skip sample"){
|
||||||
|
printf("//! [buffer period+skip sample]\n");
|
||||||
|
auto period = std::chrono::milliseconds(4);
|
||||||
|
auto skip = std::chrono::milliseconds(6);
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(1), std::chrono::milliseconds(2)).
|
||||||
|
take(7).
|
||||||
|
buffer_with_time(period, skip);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](std::vector<long> v){
|
||||||
|
printf("OnNext:");
|
||||||
|
std::for_each(v.begin(), v.end(), [](long a){
|
||||||
|
printf(" %ld", a);
|
||||||
|
});
|
||||||
|
printf("\n");
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [buffer period+skip sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("buffer period+skip overlapping sample"){
|
||||||
|
printf("//! [buffer period+skip overlapping sample]\n");
|
||||||
|
auto period = std::chrono::milliseconds(6);
|
||||||
|
auto skip = std::chrono::milliseconds(4);
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(1), std::chrono::milliseconds(2)).
|
||||||
|
take(7).
|
||||||
|
buffer_with_time(period, skip);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](std::vector<long> v){
|
||||||
|
printf("OnNext:");
|
||||||
|
std::for_each(v.begin(), v.end(), [](long a){
|
||||||
|
printf(" %ld", a);
|
||||||
|
});
|
||||||
|
printf("\n");
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [buffer period+skip overlapping sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("buffer period+skip empty sample"){
|
||||||
|
printf("//! [buffer period+skip empty sample]\n");
|
||||||
|
auto period = std::chrono::milliseconds(2);
|
||||||
|
auto skip = std::chrono::milliseconds(4);
|
||||||
|
auto values = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).
|
||||||
|
buffer_with_time(period, skip);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](std::vector<long> v){
|
||||||
|
printf("OnNext:");
|
||||||
|
std::for_each(v.begin(), v.end(), [](long a){
|
||||||
|
printf(" %ld", a);
|
||||||
|
});
|
||||||
|
printf("\n");
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [buffer period+skip empty sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("buffer period+coordination sample"){
|
||||||
|
printf("//! [buffer period+coordination sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(1), std::chrono::milliseconds(2)).
|
||||||
|
take(7).
|
||||||
|
buffer_with_time(std::chrono::milliseconds(4), rxcpp::observe_on_new_thread());
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](std::vector<long> v){
|
||||||
|
printf("OnNext:");
|
||||||
|
std::for_each(v.begin(), v.end(), [](long a){
|
||||||
|
printf(" %ld", a);
|
||||||
|
});
|
||||||
|
printf("\n");
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [buffer period+coordination sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("buffer period sample"){
|
||||||
|
printf("//! [buffer period sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(1), std::chrono::milliseconds(2)).
|
||||||
|
take(7).
|
||||||
|
buffer_with_time(std::chrono::milliseconds(4));
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](std::vector<long> v){
|
||||||
|
printf("OnNext:");
|
||||||
|
std::for_each(v.begin(), v.end(), [](long a){
|
||||||
|
printf(" %ld", a);
|
||||||
|
});
|
||||||
|
printf("\n");
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [buffer period sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("buffer period+count+coordination sample"){
|
||||||
|
printf("//! [buffer period+count+coordination sample]\n");
|
||||||
|
auto int1 = rxcpp::observable<>::range(1L, 3L);
|
||||||
|
auto int2 = rxcpp::observable<>::timer(std::chrono::milliseconds(50));
|
||||||
|
auto values = int1.
|
||||||
|
concat(int2).
|
||||||
|
buffer_with_time_or_count(std::chrono::milliseconds(20), 2, rxcpp::observe_on_event_loop());
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](std::vector<long> v){
|
||||||
|
printf("OnNext:");
|
||||||
|
std::for_each(v.begin(), v.end(), [](long a){
|
||||||
|
printf(" %ld", a);
|
||||||
|
});
|
||||||
|
printf("\n");
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [buffer period+count+coordination sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("buffer period+count sample"){
|
||||||
|
printf("//! [buffer period+count sample]\n");
|
||||||
|
auto int1 = rxcpp::observable<>::range(1L, 3L);
|
||||||
|
auto int2 = rxcpp::observable<>::timer(std::chrono::milliseconds(50));
|
||||||
|
auto values = int1.
|
||||||
|
concat(int2).
|
||||||
|
buffer_with_time_or_count(std::chrono::milliseconds(20), 2);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](std::vector<long> v){
|
||||||
|
printf("OnNext:");
|
||||||
|
std::for_each(v.begin(), v.end(), [](long a){
|
||||||
|
printf(" %ld", a);
|
||||||
|
});
|
||||||
|
printf("\n");
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [buffer period+count sample]\n");
|
||||||
|
}
|
85
3party/rxcpp/Rx/v2/examples/doxygen/combine_latest.cpp
Normal file
85
3party/rxcpp/Rx/v2/examples/doxygen/combine_latest.cpp
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("combine_latest sample"){
|
||||||
|
printf("//! [combine_latest sample]\n");
|
||||||
|
auto o1 = rxcpp::observable<>::interval(std::chrono::milliseconds(2));
|
||||||
|
auto o2 = rxcpp::observable<>::interval(std::chrono::milliseconds(3));
|
||||||
|
auto o3 = rxcpp::observable<>::interval(std::chrono::milliseconds(5));
|
||||||
|
auto values = o1.combine_latest(o2, o3);
|
||||||
|
values.
|
||||||
|
take(5).
|
||||||
|
subscribe(
|
||||||
|
[](std::tuple<int, int, int> v){printf("OnNext: %d, %d, %d\n", std::get<0>(v), std::get<1>(v), std::get<2>(v));},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [combine_latest sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "main.hpp"
|
||||||
|
|
||||||
|
SCENARIO("Coordination combine_latest sample"){
|
||||||
|
printf("//! [Coordination combine_latest sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto thr = rxcpp::synchronize_event_loop();
|
||||||
|
auto o1 = rxcpp::observable<>::interval(std::chrono::milliseconds(2)).map([](int v) {
|
||||||
|
printf("[thread %s] Source1 OnNext: %d\n", get_pid().c_str(), v);
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
auto o2 = rxcpp::observable<>::interval(std::chrono::milliseconds(3)).map([](int v) {
|
||||||
|
printf("[thread %s] Source2 OnNext: %d\n", get_pid().c_str(), v);
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
auto o3 = rxcpp::observable<>::interval(std::chrono::milliseconds(5)).map([](int v) {
|
||||||
|
printf("[thread %s] Source3 OnNext: %d\n", get_pid().c_str(), v);
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
auto values = o1.combine_latest(thr, o2, o3);
|
||||||
|
values.
|
||||||
|
take(5).
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](std::tuple<int, int, int> v){printf("[thread %s] OnNext: %d, %d, %d\n", get_pid().c_str(), std::get<0>(v), std::get<1>(v), std::get<2>(v));},
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [Coordination combine_latest sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("Selector combine_latest sample"){
|
||||||
|
printf("//! [Selector combine_latest sample]\n");
|
||||||
|
auto o1 = rxcpp::observable<>::interval(std::chrono::milliseconds(2));
|
||||||
|
auto o2 = rxcpp::observable<>::interval(std::chrono::milliseconds(3));
|
||||||
|
auto o3 = rxcpp::observable<>::interval(std::chrono::milliseconds(5));
|
||||||
|
auto values = o1.combine_latest(
|
||||||
|
[](int v1, int v2, int v3) {
|
||||||
|
return 100 * v1 + 10 * v2 + v3;
|
||||||
|
},
|
||||||
|
o2, o3);
|
||||||
|
values.
|
||||||
|
take(5).
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [Selector combine_latest sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("Coordination+Selector combine_latest sample"){
|
||||||
|
printf("//! [Coordination+Selector combine_latest sample]\n");
|
||||||
|
auto o1 = rxcpp::observable<>::interval(std::chrono::milliseconds(2));
|
||||||
|
auto o2 = rxcpp::observable<>::interval(std::chrono::milliseconds(3));
|
||||||
|
auto o3 = rxcpp::observable<>::interval(std::chrono::milliseconds(5));
|
||||||
|
auto values = o1.combine_latest(
|
||||||
|
rxcpp::observe_on_new_thread(),
|
||||||
|
[](int v1, int v2, int v3) {
|
||||||
|
return 100 * v1 + 10 * v2 + v3;
|
||||||
|
},
|
||||||
|
o2, o3);
|
||||||
|
values.
|
||||||
|
take(5).
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [Coordination+Selector combine_latest sample]\n");
|
||||||
|
}
|
33
3party/rxcpp/Rx/v2/examples/doxygen/composite_exception.cpp
Normal file
33
3party/rxcpp/Rx/v2/examples/doxygen/composite_exception.cpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
namespace rxu=rxcpp::util;
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
#if RXCPP_USE_EXCEPTIONS
|
||||||
|
SCENARIO("composite_exception sample"){
|
||||||
|
printf("//! [composite_exception sample]\n");
|
||||||
|
auto o1 = rxcpp::observable<>::error<int>(std::runtime_error("Error from source o1\n"));
|
||||||
|
auto o2 = rxcpp::observable<>::error<int>(std::runtime_error("Error from source o2\n"));
|
||||||
|
auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {return 3;});
|
||||||
|
auto values = o1.merge_delay_error(o2, o3);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](std::exception_ptr composite_e) {
|
||||||
|
printf("OnError %s\n", rxu::what(composite_e).c_str());
|
||||||
|
try { std::rethrow_exception(composite_e); }
|
||||||
|
catch(rxcpp::composite_exception const &ce) {
|
||||||
|
for(std::exception_ptr particular_e : ce.exceptions) {
|
||||||
|
|
||||||
|
try{ std::rethrow_exception(particular_e); }
|
||||||
|
catch(std::runtime_error const &error) { printf(" *** %s\n", error.what()); }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");}
|
||||||
|
);
|
||||||
|
printf("//! [composite_exception sample]\n");
|
||||||
|
}
|
||||||
|
#endif
|
60
3party/rxcpp/Rx/v2/examples/doxygen/concat.cpp
Normal file
60
3party/rxcpp/Rx/v2/examples/doxygen/concat.cpp
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("concat sample"){
|
||||||
|
printf("//! [concat sample]\n");
|
||||||
|
auto o1 = rxcpp::observable<>::range(1, 3);
|
||||||
|
auto o2 = rxcpp::observable<>::just(4);
|
||||||
|
auto o3 = rxcpp::observable<>::from(5, 6);
|
||||||
|
auto values = o1.concat(o2, o3);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [concat sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("implicit concat sample"){
|
||||||
|
printf("//! [implicit concat sample]\n");
|
||||||
|
auto o1 = rxcpp::observable<>::range(1, 3);
|
||||||
|
auto o2 = rxcpp::observable<>::just(4);
|
||||||
|
auto o3 = rxcpp::observable<>::from(5, 6);
|
||||||
|
auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
|
||||||
|
auto values = base.concat();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [implicit concat sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded concat sample"){
|
||||||
|
printf("//! [threaded concat sample]\n");
|
||||||
|
auto o1 = rxcpp::observable<>::range(1, 3);
|
||||||
|
auto o2 = rxcpp::observable<>::just(4);
|
||||||
|
auto o3 = rxcpp::observable<>::from(5, 6);
|
||||||
|
auto values = o1.concat(rxcpp::observe_on_new_thread(), o2, o3);
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [threaded concat sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded implicit concat sample"){
|
||||||
|
printf("//! [threaded implicit concat sample]\n");
|
||||||
|
auto o1 = rxcpp::observable<>::range(1, 3);
|
||||||
|
auto o2 = rxcpp::observable<>::just(4);
|
||||||
|
auto o3 = rxcpp::observable<>::from(5, 6);
|
||||||
|
auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
|
||||||
|
auto values = base.concat(rxcpp::observe_on_new_thread());
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [threaded implicit concat sample]\n");
|
||||||
|
}
|
50
3party/rxcpp/Rx/v2/examples/doxygen/concat_map.cpp
Normal file
50
3party/rxcpp/Rx/v2/examples/doxygen/concat_map.cpp
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("concat_map sample"){
|
||||||
|
printf("//! [concat_map sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
concat_map(
|
||||||
|
[](int v){
|
||||||
|
return
|
||||||
|
rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(10 * v), std::chrono::milliseconds(50)).
|
||||||
|
take(3);
|
||||||
|
},
|
||||||
|
[](int v_main, long v_sub){
|
||||||
|
return std::make_tuple(v_main, v_sub);
|
||||||
|
});
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](std::tuple<int, long> v){printf("OnNext: %d - %ld\n", std::get<0>(v), std::get<1>(v));},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [concat_map sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "main.hpp"
|
||||||
|
|
||||||
|
SCENARIO("threaded concat_map sample"){
|
||||||
|
printf("//! [threaded concat_map sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
concat_map(
|
||||||
|
[](int v){
|
||||||
|
printf("[thread %s] Call CollectionSelector(v = %d)\n", get_pid().c_str(), v);
|
||||||
|
return
|
||||||
|
rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(10 * v), std::chrono::milliseconds(50)).
|
||||||
|
take(3);
|
||||||
|
},
|
||||||
|
[](int v_main, long v_sub){
|
||||||
|
printf("[thread %s] Call ResultSelector(v_main = %d, v_sub = %ld)\n", get_pid().c_str(), v_main, v_sub);
|
||||||
|
return std::make_tuple(v_main, v_sub);
|
||||||
|
},
|
||||||
|
rxcpp::observe_on_new_thread());
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](std::tuple<int, long> v){printf("[thread %s] OnNext: %d - %ld\n", get_pid().c_str(), std::get<0>(v), std::get<1>(v));},
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [threaded concat_map sample]\n");
|
||||||
|
}
|
29
3party/rxcpp/Rx/v2/examples/doxygen/contains.cpp
Normal file
29
3party/rxcpp/Rx/v2/examples/doxygen/contains.cpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("contains sample") {
|
||||||
|
printf("//! [contains sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::from(1, 2, 3, 4, 5).contains(3);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
|
||||||
|
[]() { printf("OnCompleted\n"); });
|
||||||
|
printf("//! [contains sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("contains - operator syntax sample") {
|
||||||
|
using namespace rxcpp;
|
||||||
|
using namespace rxcpp::sources;
|
||||||
|
using namespace rxcpp::operators;
|
||||||
|
|
||||||
|
printf("//! [contains - operator syntax sample]\n");
|
||||||
|
auto values = range(1, 10)
|
||||||
|
| contains(2);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
|
||||||
|
[]() { printf("OnCompleted\n"); });
|
||||||
|
printf("//! [contains - operator syntax sample]\n");
|
||||||
|
}
|
100
3party/rxcpp/Rx/v2/examples/doxygen/create.cpp
Normal file
100
3party/rxcpp/Rx/v2/examples/doxygen/create.cpp
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("Create sample"){
|
||||||
|
printf("//! [Create sample]\n");
|
||||||
|
auto ints = rxcpp::observable<>::create<int>(
|
||||||
|
[](rxcpp::subscriber<int> s){
|
||||||
|
s.on_next(1);
|
||||||
|
s.on_next(2);
|
||||||
|
s.on_completed();
|
||||||
|
});
|
||||||
|
|
||||||
|
ints.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [Create sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("Create bad code"){
|
||||||
|
printf("//! [Create bad code]\n");
|
||||||
|
auto subscription = rxcpp::composite_subscription();
|
||||||
|
auto subscriber = rxcpp::make_subscriber<int>(
|
||||||
|
subscription,
|
||||||
|
[&](int v){
|
||||||
|
printf("OnNext: %d\n", v);
|
||||||
|
if (v == 2)
|
||||||
|
subscription.unsubscribe();
|
||||||
|
},
|
||||||
|
[](){
|
||||||
|
printf("OnCompleted\n");
|
||||||
|
});
|
||||||
|
rxcpp::observable<>::create<int>(
|
||||||
|
[](rxcpp::subscriber<int> s){
|
||||||
|
for (int i = 0; i < 5; ++i) {
|
||||||
|
s.on_next(i);
|
||||||
|
printf("Just sent: OnNext(%d)\n", i);
|
||||||
|
}
|
||||||
|
s.on_completed();
|
||||||
|
printf("Just sent: OnCompleted()\n");
|
||||||
|
}).subscribe(subscriber);
|
||||||
|
printf("//! [Create bad code]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("Create good code"){
|
||||||
|
printf("//! [Create good code]\n");
|
||||||
|
auto subscription = rxcpp::composite_subscription();
|
||||||
|
auto subscriber = rxcpp::make_subscriber<int>(
|
||||||
|
subscription,
|
||||||
|
[&](int v){
|
||||||
|
printf("OnNext: %d\n", v);
|
||||||
|
if (v == 2)
|
||||||
|
subscription.unsubscribe();
|
||||||
|
},
|
||||||
|
[](){
|
||||||
|
printf("OnCompleted\n");
|
||||||
|
});
|
||||||
|
rxcpp::observable<>::create<int>(
|
||||||
|
[](rxcpp::subscriber<int> s){
|
||||||
|
for (int i = 0; i < 5; ++i) {
|
||||||
|
if (!s.is_subscribed()) // Stop emitting if nobody is listening
|
||||||
|
break;
|
||||||
|
s.on_next(i);
|
||||||
|
printf("Just sent: OnNext(%d)\n", i);
|
||||||
|
}
|
||||||
|
s.on_completed();
|
||||||
|
printf("Just sent: OnCompleted()\n");
|
||||||
|
}).subscribe(subscriber);
|
||||||
|
printf("//! [Create good code]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("Create great code"){
|
||||||
|
printf("//! [Create great code]\n");
|
||||||
|
auto ints = rxcpp::observable<>::create<int>(
|
||||||
|
[](rxcpp::subscriber<int> s){
|
||||||
|
for (int i = 0; i < 5; ++i) {
|
||||||
|
if (!s.is_subscribed()) // Stop emitting if nobody is listening
|
||||||
|
break;
|
||||||
|
s.on_next(i);
|
||||||
|
printf("Just sent: OnNext(%d)\n", i);
|
||||||
|
}
|
||||||
|
s.on_completed();
|
||||||
|
printf("Just sent: OnCompleted()\n");
|
||||||
|
});
|
||||||
|
ints.
|
||||||
|
take(2).
|
||||||
|
subscribe(
|
||||||
|
[](int v){
|
||||||
|
printf("OnNext: %d\n", v);
|
||||||
|
},
|
||||||
|
[](rxcpp::util::error_ptr ep){
|
||||||
|
printf("OnError: %s\n", rxcpp::util::what(ep).c_str());
|
||||||
|
},
|
||||||
|
[](){
|
||||||
|
printf("OnCompleted\n");
|
||||||
|
});
|
||||||
|
printf("//! [Create great code]\n");
|
||||||
|
}
|
20
3party/rxcpp/Rx/v2/examples/doxygen/debounce.cpp
Normal file
20
3party/rxcpp/Rx/v2/examples/doxygen/debounce.cpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("debounce sample"){
|
||||||
|
printf("//! [debounce sample]\n");
|
||||||
|
using namespace std::chrono;
|
||||||
|
auto scheduler = rxcpp::identity_current_thread();
|
||||||
|
auto start = scheduler.now();
|
||||||
|
auto period = milliseconds(10);
|
||||||
|
auto values = rxcpp::observable<>::interval(start, period, scheduler).
|
||||||
|
take(4).
|
||||||
|
debounce(period);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](long v) { printf("OnNext: %ld\n", v); },
|
||||||
|
[]() { printf("OnCompleted\n"); });
|
||||||
|
printf("//! [debounce sample]\n");
|
||||||
|
}
|
17
3party/rxcpp/Rx/v2/examples/doxygen/default_if_empty.cpp
Normal file
17
3party/rxcpp/Rx/v2/examples/doxygen/default_if_empty.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("default_if_empty sample"){
|
||||||
|
printf("//! [default_if_empty sample]\n");
|
||||||
|
|
||||||
|
auto values = rxcpp::observable<>::empty<int>()
|
||||||
|
.default_if_empty(42);
|
||||||
|
|
||||||
|
values.subscribe(
|
||||||
|
[](int v) { printf("OnNext: %d\n", v); },
|
||||||
|
[]() { printf("OnCompleted\n"); } );
|
||||||
|
|
||||||
|
printf("//! [default_if_empty sample]\n");
|
||||||
|
}
|
16
3party/rxcpp/Rx/v2/examples/doxygen/defer.cpp
Normal file
16
3party/rxcpp/Rx/v2/examples/doxygen/defer.cpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("defer sample"){
|
||||||
|
printf("//! [defer sample]\n");
|
||||||
|
auto observable_factory = [](){return rxcpp::observable<>::range(1, 3);};
|
||||||
|
auto values = rxcpp::observable<>::defer(observable_factory);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [defer sample]\n");
|
||||||
|
}
|
||||||
|
|
53
3party/rxcpp/Rx/v2/examples/doxygen/delay.cpp
Normal file
53
3party/rxcpp/Rx/v2/examples/doxygen/delay.cpp
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("delay period+coordination sample"){
|
||||||
|
printf("//! [delay period+coordination sample]\n");
|
||||||
|
using namespace std::chrono;
|
||||||
|
auto scheduler = rxcpp::identity_current_thread();
|
||||||
|
auto start = scheduler.now();
|
||||||
|
auto period = milliseconds(10);
|
||||||
|
const auto next = [=](const char* s) {
|
||||||
|
return [=](long v){
|
||||||
|
auto t = duration_cast<milliseconds>(scheduler.now() - start);
|
||||||
|
long long int ms = t.count();
|
||||||
|
printf("[%s @ %lld] OnNext: %ld\n", s, ms, v);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
auto values = rxcpp::observable<>::interval(start, period, scheduler).
|
||||||
|
take(4).
|
||||||
|
tap(next("interval")).
|
||||||
|
delay(period, rxcpp::observe_on_new_thread());
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
next(" delayed"),
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [delay period+coordination sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("delay period sample"){
|
||||||
|
printf("//! [delay period sample]\n");
|
||||||
|
using namespace std::chrono;
|
||||||
|
auto scheduler = rxcpp::identity_current_thread();
|
||||||
|
auto start = scheduler.now();
|
||||||
|
auto period = milliseconds(10);
|
||||||
|
const auto next = [=](const char* s) {
|
||||||
|
return [=](long v){
|
||||||
|
auto t = duration_cast<milliseconds>(scheduler.now() - start);
|
||||||
|
long long int ms = t.count();
|
||||||
|
printf("[%s @ %lld] OnNext: %ld\n", s, ms, v);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
auto values = rxcpp::observable<>::interval(start, period, scheduler).
|
||||||
|
take(4).
|
||||||
|
tap(next("interval")).
|
||||||
|
delay(period);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
next(" delayed"),
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [delay period sample]\n");
|
||||||
|
}
|
15
3party/rxcpp/Rx/v2/examples/doxygen/distinct.cpp
Normal file
15
3party/rxcpp/Rx/v2/examples/doxygen/distinct.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("distinct sample"){
|
||||||
|
printf("//! [distinct sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::from(1, 2, 2, 3, 3, 3, 4, 5, 5).distinct();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [distinct sample]\n");
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("distinct_until_changed sample"){
|
||||||
|
printf("//! [distinct_until_changed sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::from(1, 2, 2, 3, 3, 3, 4, 5, 5).distinct_until_changed();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [distinct_until_changed sample]\n");
|
||||||
|
}
|
||||||
|
|
14
3party/rxcpp/Rx/v2/examples/doxygen/element_at.cpp
Normal file
14
3party/rxcpp/Rx/v2/examples/doxygen/element_at.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("element_at sample"){
|
||||||
|
printf("//! [element_at sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 7).element_at(3);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [element_at sample]\n");
|
||||||
|
}
|
37
3party/rxcpp/Rx/v2/examples/doxygen/empty.cpp
Normal file
37
3party/rxcpp/Rx/v2/examples/doxygen/empty.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("empty sample"){
|
||||||
|
printf("//! [empty sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::empty<int>();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [empty sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded empty sample"){
|
||||||
|
printf("//! [threaded empty sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::empty<int>(rxcpp::observe_on_event_loop());
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [threaded empty sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("empty operator syntax sample"){
|
||||||
|
using namespace rxcpp::sources;
|
||||||
|
|
||||||
|
printf("//! [empty operator syntax sample]\n");
|
||||||
|
auto values = empty<int>();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [empty operator syntax sample]\n");
|
||||||
|
}
|
31
3party/rxcpp/Rx/v2/examples/doxygen/error.cpp
Normal file
31
3party/rxcpp/Rx/v2/examples/doxygen/error.cpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("error sample"){
|
||||||
|
printf("//! [error sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::error<int>(std::runtime_error("Error from source"));
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](rxcpp::util::error_ptr ep){
|
||||||
|
printf("OnError: %s\n", rxcpp::util::what(ep).c_str());
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [error sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded error sample"){
|
||||||
|
printf("//! [threaded error sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::error<int>(std::runtime_error("Error from source"), rxcpp::observe_on_event_loop());
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](rxcpp::util::error_ptr ep){
|
||||||
|
printf("OnError: %s\n", rxcpp::util::what(ep).c_str());
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [threaded error sample]\n");
|
||||||
|
}
|
29
3party/rxcpp/Rx/v2/examples/doxygen/exists.cpp
Normal file
29
3party/rxcpp/Rx/v2/examples/doxygen/exists.cpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("exists sample") {
|
||||||
|
printf("//! [exists sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::from(1, 2, 3, 4, 5).exists([](int n) { return n > 3; });
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
|
||||||
|
[]() { printf("OnCompleted\n"); });
|
||||||
|
printf("//! [exists sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("exists - operator syntax sample") {
|
||||||
|
using namespace rxcpp;
|
||||||
|
using namespace rxcpp::sources;
|
||||||
|
using namespace rxcpp::operators;
|
||||||
|
|
||||||
|
printf("//! [exists - operator syntax sample]\n");
|
||||||
|
auto values = range(1, 10)
|
||||||
|
| exists([](int n) { return n == 1; });
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
|
||||||
|
[]() { printf("OnCompleted\n"); });
|
||||||
|
printf("//! [exists - operator syntax sample]\n");
|
||||||
|
}
|
17
3party/rxcpp/Rx/v2/examples/doxygen/filter.cpp
Normal file
17
3party/rxcpp/Rx/v2/examples/doxygen/filter.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("filter sample"){
|
||||||
|
printf("//! [filter sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 6).
|
||||||
|
filter([](int v){
|
||||||
|
return v % 2;
|
||||||
|
});
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [filter sample]\n");
|
||||||
|
}
|
34
3party/rxcpp/Rx/v2/examples/doxygen/finally.cpp
Normal file
34
3party/rxcpp/Rx/v2/examples/doxygen/finally.cpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("finally sample"){
|
||||||
|
printf("//! [finally sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
finally([](){
|
||||||
|
printf("The final action\n");
|
||||||
|
});
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [finally sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("error finally sample"){
|
||||||
|
printf("//! [error finally sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
|
||||||
|
finally([](){
|
||||||
|
printf("The final action\n");
|
||||||
|
});
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](rxcpp::util::error_ptr ep){
|
||||||
|
printf("OnError: %s\n", rxcpp::util::what(ep).c_str());
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [error finally sample]\n");
|
||||||
|
}
|
50
3party/rxcpp/Rx/v2/examples/doxygen/flat_map.cpp
Normal file
50
3party/rxcpp/Rx/v2/examples/doxygen/flat_map.cpp
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("flat_map sample"){
|
||||||
|
printf("//! [flat_map sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
flat_map(
|
||||||
|
[](int v){
|
||||||
|
return
|
||||||
|
rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(10 * v), std::chrono::milliseconds(50)).
|
||||||
|
take(3);
|
||||||
|
},
|
||||||
|
[](int v_main, long v_sub){
|
||||||
|
return std::make_tuple(v_main, v_sub);
|
||||||
|
});
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](std::tuple<int, long> v){printf("OnNext: %d - %ld\n", std::get<0>(v), std::get<1>(v));},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [flat_map sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "main.hpp"
|
||||||
|
|
||||||
|
SCENARIO("threaded flat_map sample"){
|
||||||
|
printf("//! [threaded flat_map sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
flat_map(
|
||||||
|
[](int v){
|
||||||
|
printf("[thread %s] Call CollectionSelector(v = %d)\n", get_pid().c_str(), v);
|
||||||
|
return
|
||||||
|
rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(10 * v), std::chrono::milliseconds(50)).
|
||||||
|
take(3);
|
||||||
|
},
|
||||||
|
[](int v_main, int v_sub){
|
||||||
|
printf("[thread %s] Call ResultSelector(v_main = %d, v_sub = %d)\n", get_pid().c_str(), v_main, v_sub);
|
||||||
|
return std::make_tuple(v_main, v_sub);
|
||||||
|
},
|
||||||
|
rxcpp::observe_on_new_thread());
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](std::tuple<int, long> v){printf("[thread %s] OnNext: %d - %ld\n", get_pid().c_str(), std::get<0>(v), std::get<1>(v));},
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [threaded flat_map sample]\n");
|
||||||
|
}
|
33
3party/rxcpp/Rx/v2/examples/doxygen/from.cpp
Normal file
33
3party/rxcpp/Rx/v2/examples/doxygen/from.cpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("from sample"){
|
||||||
|
printf("//! [from sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::from(1, 2, 3);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [from sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "main.hpp"
|
||||||
|
|
||||||
|
SCENARIO("threaded from sample"){
|
||||||
|
printf("//! [threaded from sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto values = rxcpp::observable<>::from(rxcpp::observe_on_new_thread(), 1, 2, 3).map([](int v){
|
||||||
|
printf("[thread %s] Emit value: %d\n", get_pid().c_str(), v);
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("[thread %s] OnNext: %d\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [threaded from sample]\n");
|
||||||
|
}
|
||||||
|
|
56
3party/rxcpp/Rx/v2/examples/doxygen/group_by.cpp
Normal file
56
3party/rxcpp/Rx/v2/examples/doxygen/group_by.cpp
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
SCENARIO("group_by sample"){
|
||||||
|
printf("//! [group_by sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(0, 8).
|
||||||
|
group_by(
|
||||||
|
[](int v){return v % 3;},
|
||||||
|
[](int v){return 10 * v;});
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](rxcpp::grouped_observable<int, int> g){
|
||||||
|
auto key = g.get_key();
|
||||||
|
printf("OnNext: key = %d\n", key);
|
||||||
|
g.subscribe(
|
||||||
|
[key](int v){printf("[key %d] OnNext: %d\n", key, v);},
|
||||||
|
[key](){printf("[key %d] OnCompleted\n", key);});
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [group_by sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
//! [group_by full intro]
|
||||||
|
static bool less(int v1, int v2){
|
||||||
|
return v1 < v2;
|
||||||
|
}
|
||||||
|
//! [group_by full intro]
|
||||||
|
|
||||||
|
SCENARIO("group_by full sample"){
|
||||||
|
printf("//! [group_by full sample]\n");
|
||||||
|
auto data = rxcpp::observable<>::range(0, 8).
|
||||||
|
map([](int v){
|
||||||
|
std::stringstream s;
|
||||||
|
s << "Value " << v;
|
||||||
|
return std::make_pair(v % 3, s.str());
|
||||||
|
});
|
||||||
|
auto values = data.group_by(
|
||||||
|
[](std::pair<int, std::string> v){return v.first;},
|
||||||
|
[](std::pair<int, std::string> v){return v.second;},
|
||||||
|
less);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](rxcpp::grouped_observable<int, std::string> g){
|
||||||
|
auto key = g.get_key();
|
||||||
|
printf("OnNext: key = %d\n", key);
|
||||||
|
g.subscribe(
|
||||||
|
[key](const std::string& v){printf("[key %d] OnNext: %s\n", key, v.c_str());},
|
||||||
|
[key](){printf("[key %d] OnCompleted\n", key);});
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [group_by full sample]\n");
|
||||||
|
}
|
15
3party/rxcpp/Rx/v2/examples/doxygen/ignore_elements.cpp
Normal file
15
3party/rxcpp/Rx/v2/examples/doxygen/ignore_elements.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("ignore_elements sample"){
|
||||||
|
printf("//! [ignore_elements sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::from(1, 2, 3, 4, 5).ignore_elements();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v) { printf("OnNext: %d\n", v); },
|
||||||
|
[]() { printf("OnCompleted\n"); });
|
||||||
|
printf("//! [ignore_elements sample]\n");
|
||||||
|
}
|
||||||
|
|
56
3party/rxcpp/Rx/v2/examples/doxygen/interval.cpp
Normal file
56
3party/rxcpp/Rx/v2/examples/doxygen/interval.cpp
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("immediate interval sample"){
|
||||||
|
printf("//! [immediate interval sample]\n");
|
||||||
|
auto period = std::chrono::milliseconds(1);
|
||||||
|
auto values = rxcpp::observable<>::interval(period);
|
||||||
|
values.
|
||||||
|
take(3).
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [immediate interval sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded immediate interval sample"){
|
||||||
|
printf("//! [threaded immediate interval sample]\n");
|
||||||
|
auto scheduler = rxcpp::identity_current_thread();
|
||||||
|
auto period = std::chrono::milliseconds(1);
|
||||||
|
auto values = rxcpp::observable<>::interval(period, scheduler);
|
||||||
|
values.
|
||||||
|
take(3).
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [threaded immediate interval sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("interval sample"){
|
||||||
|
printf("//! [interval sample]\n");
|
||||||
|
auto start = std::chrono::steady_clock::now() + std::chrono::milliseconds(1);
|
||||||
|
auto period = std::chrono::milliseconds(1);
|
||||||
|
auto values = rxcpp::observable<>::interval(start, period);
|
||||||
|
values.
|
||||||
|
take(3).
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [interval sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded interval sample"){
|
||||||
|
printf("//! [threaded interval sample]\n");
|
||||||
|
auto scheduler = rxcpp::identity_current_thread();
|
||||||
|
auto start = scheduler.now() + std::chrono::milliseconds(1);
|
||||||
|
auto period = std::chrono::milliseconds(1);
|
||||||
|
auto values = rxcpp::observable<>::interval(start, period, scheduler);
|
||||||
|
values.
|
||||||
|
take(3).
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [threaded interval sample]\n");
|
||||||
|
}
|
14
3party/rxcpp/Rx/v2/examples/doxygen/is_empty.cpp
Normal file
14
3party/rxcpp/Rx/v2/examples/doxygen/is_empty.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("is_empty sample") {
|
||||||
|
printf("//! [is_empty sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::from(1, 2, 3, 4, 5).is_empty();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
|
||||||
|
[]() { printf("OnCompleted\n"); });
|
||||||
|
printf("//! [is_empty sample]\n");
|
||||||
|
}
|
27
3party/rxcpp/Rx/v2/examples/doxygen/iterate.cpp
Normal file
27
3party/rxcpp/Rx/v2/examples/doxygen/iterate.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("iterate sample"){
|
||||||
|
printf("//! [iterate sample]\n");
|
||||||
|
std::array< int, 3 > a={{1, 2, 3}};
|
||||||
|
auto values = rxcpp::observable<>::iterate(a);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [iterate sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded iterate sample"){
|
||||||
|
printf("//! [threaded iterate sample]\n");
|
||||||
|
std::array< int, 3 > a={{1, 2, 3}};
|
||||||
|
auto values = rxcpp::observable<>::iterate(a, rxcpp::observe_on_event_loop());
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [threaded iterate sample]\n");
|
||||||
|
}
|
25
3party/rxcpp/Rx/v2/examples/doxygen/just.cpp
Normal file
25
3party/rxcpp/Rx/v2/examples/doxygen/just.cpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("just sample"){
|
||||||
|
printf("//! [just sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::just(1);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [just sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded just sample"){
|
||||||
|
printf("//! [threaded just sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::just(1, rxcpp::observe_on_event_loop());
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [threaded just sample]\n");
|
||||||
|
}
|
14
3party/rxcpp/Rx/v2/examples/doxygen/main.cpp
Normal file
14
3party/rxcpp/Rx/v2/examples/doxygen/main.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#define CATCH_CONFIG_MAIN
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <thread>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "main.hpp"
|
||||||
|
|
||||||
|
std::string get_pid() {
|
||||||
|
std::stringstream s;
|
||||||
|
s << std::this_thread::get_id();
|
||||||
|
return s.str();
|
||||||
|
}
|
3
3party/rxcpp/Rx/v2/examples/doxygen/main.hpp
Normal file
3
3party/rxcpp/Rx/v2/examples/doxygen/main.hpp
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
std::string get_pid();
|
17
3party/rxcpp/Rx/v2/examples/doxygen/map.cpp
Normal file
17
3party/rxcpp/Rx/v2/examples/doxygen/map.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("map sample"){
|
||||||
|
printf("//! [map sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
map([](int v){
|
||||||
|
return 2 * v;
|
||||||
|
});
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [map sample]\n");
|
||||||
|
}
|
274
3party/rxcpp/Rx/v2/examples/doxygen/math.cpp
Normal file
274
3party/rxcpp/Rx/v2/examples/doxygen/math.cpp
Normal file
@ -0,0 +1,274 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("first sample"){
|
||||||
|
printf("//! [first sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).first();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [first sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#if RXCPP_USE_EXCEPTIONS
|
||||||
|
SCENARIO("first empty sample"){
|
||||||
|
printf("//! [first empty sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::empty<int>().first();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
try {std::rethrow_exception(ep);}
|
||||||
|
catch (const rxcpp::empty_error& ex) {
|
||||||
|
printf("OnError: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [first empty sample]\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SCENARIO("last sample"){
|
||||||
|
printf("//! [last sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).last();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [last sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#if RXCPP_USE_EXCEPTIONS
|
||||||
|
SCENARIO("last empty sample"){
|
||||||
|
printf("//! [last empty sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::empty<int>().last();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
try {std::rethrow_exception(ep);}
|
||||||
|
catch (const rxcpp::empty_error& ex) {
|
||||||
|
printf("OnError: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [last empty sample]\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SCENARIO("count sample"){
|
||||||
|
printf("//! [count sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).count();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [count sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#if RXCPP_USE_EXCEPTIONS
|
||||||
|
SCENARIO("count error sample"){
|
||||||
|
printf("//! [count error sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
|
||||||
|
count();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
try {std::rethrow_exception(ep);}
|
||||||
|
catch (const std::runtime_error& ex) {
|
||||||
|
printf("OnError: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [count error sample]\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SCENARIO("sum sample"){
|
||||||
|
printf("//! [sum sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).sum();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [sum sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#if RXCPP_USE_EXCEPTIONS
|
||||||
|
SCENARIO("sum empty sample"){
|
||||||
|
printf("//! [sum empty sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::empty<int>().sum();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
try {std::rethrow_exception(ep);}
|
||||||
|
catch (const rxcpp::empty_error& ex) {
|
||||||
|
printf("OnError: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [sum empty sample]\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SCENARIO("sum error sample"){
|
||||||
|
printf("//! [sum error sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
|
||||||
|
sum();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
try {std::rethrow_exception(ep);}
|
||||||
|
catch (const std::runtime_error& ex) {
|
||||||
|
printf("OnError: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [sum error sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("average sample"){
|
||||||
|
printf("//! [average sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 4).average();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](double v){printf("OnNext: %lf\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [average sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#if RXCPP_USE_EXCEPTIONS
|
||||||
|
SCENARIO("average empty sample"){
|
||||||
|
printf("//! [average empty sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::empty<int>().average();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](double v){printf("OnNext: %lf\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
try {std::rethrow_exception(ep);}
|
||||||
|
catch (const rxcpp::empty_error& ex) {
|
||||||
|
printf("OnError: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [average empty sample]\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SCENARIO("average error sample"){
|
||||||
|
printf("//! [average error sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 4).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
|
||||||
|
average();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](double v){printf("OnNext: %lf\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
try {std::rethrow_exception(ep);}
|
||||||
|
catch (const std::runtime_error& ex) {
|
||||||
|
printf("OnError: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [average error sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("max sample"){
|
||||||
|
printf("//! [max sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 4).max();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](double v){printf("OnNext: %lf\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [max sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#if RXCPP_USE_EXCEPTIONS
|
||||||
|
SCENARIO("max empty sample"){
|
||||||
|
printf("//! [max empty sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::empty<int>().max();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](double v){printf("OnNext: %lf\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
try {std::rethrow_exception(ep);}
|
||||||
|
catch (const rxcpp::empty_error& ex) {
|
||||||
|
printf("OnError: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [max empty sample]\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SCENARIO("max error sample"){
|
||||||
|
printf("//! [max error sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 4).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
|
||||||
|
max();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](double v){printf("OnNext: %lf\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
try {std::rethrow_exception(ep);}
|
||||||
|
catch (const std::runtime_error& ex) {
|
||||||
|
printf("OnError: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [max error sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("min sample"){
|
||||||
|
printf("//! [min sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 4).min();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](double v){printf("OnNext: %lf\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [min sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#if RXCPP_USE_EXCEPTIONS
|
||||||
|
SCENARIO("min empty sample"){
|
||||||
|
printf("//! [min empty sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::empty<int>().min();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](double v){printf("OnNext: %lf\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
try {std::rethrow_exception(ep);}
|
||||||
|
catch (const rxcpp::empty_error& ex) {
|
||||||
|
printf("OnError: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [min empty sample]\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SCENARIO("min error sample"){
|
||||||
|
printf("//! [min error sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 4).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
|
||||||
|
min();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](double v){printf("OnNext: %lf\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
try {std::rethrow_exception(ep);}
|
||||||
|
catch (const std::runtime_error& ex) {
|
||||||
|
printf("OnError: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [min error sample]\n");
|
||||||
|
}
|
84
3party/rxcpp/Rx/v2/examples/doxygen/merge.cpp
Normal file
84
3party/rxcpp/Rx/v2/examples/doxygen/merge.cpp
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("merge sample"){
|
||||||
|
printf("//! [merge sample]\n");
|
||||||
|
auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(15)).map([](int) {return 1;});
|
||||||
|
auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](int) {return 2;});
|
||||||
|
auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {return 3;});
|
||||||
|
auto values = o1.merge(o2, o3);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [merge sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("implicit merge sample"){
|
||||||
|
printf("//! [implicit merge sample]\n");
|
||||||
|
auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(15)).map([](int) {return 1;});
|
||||||
|
auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](int) {return 2;});
|
||||||
|
auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {return 3;});
|
||||||
|
auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
|
||||||
|
auto values = base.merge();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [implicit merge sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "main.hpp"
|
||||||
|
|
||||||
|
SCENARIO("threaded merge sample"){
|
||||||
|
printf("//! [threaded merge sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](int) {
|
||||||
|
printf("[thread %s] Timer1 fired\n", get_pid().c_str());
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(20)).map([](int) {
|
||||||
|
printf("[thread %s] Timer2 fired\n", get_pid().c_str());
|
||||||
|
return 2;
|
||||||
|
});
|
||||||
|
auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(30)).map([](int) {
|
||||||
|
printf("[thread %s] Timer3 fired\n", get_pid().c_str());
|
||||||
|
return 3;
|
||||||
|
});
|
||||||
|
auto values = o1.merge(rxcpp::observe_on_new_thread(), o2, o3);
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("[thread %s] OnNext: %d\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [threaded merge sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded implicit merge sample"){
|
||||||
|
printf("//! [threaded implicit merge sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](int) {
|
||||||
|
printf("[thread %s] Timer1 fired\n", get_pid().c_str());
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(20)).map([](int) {
|
||||||
|
printf("[thread %s] Timer2 fired\n", get_pid().c_str());
|
||||||
|
return 2;
|
||||||
|
});
|
||||||
|
auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(30)).map([](int) {
|
||||||
|
printf("[thread %s] Timer3 fired\n", get_pid().c_str());
|
||||||
|
return 3;
|
||||||
|
});
|
||||||
|
auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
|
||||||
|
auto values = base.merge(rxcpp::observe_on_new_thread());
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("[thread %s] OnNext: %d\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [threaded implicit merge sample]\n");
|
||||||
|
}
|
99
3party/rxcpp/Rx/v2/examples/doxygen/merge_delay_error.cpp
Normal file
99
3party/rxcpp/Rx/v2/examples/doxygen/merge_delay_error.cpp
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
namespace rxu=rxcpp::util;
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
SCENARIO("merge_delay_error sample"){
|
||||||
|
printf("//! [merge_delay_error sample]\n");
|
||||||
|
auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(15)).map([](int) {return 1;});
|
||||||
|
auto o2 = rxcpp::observable<>::error<int>(std::runtime_error("Error from source\n"));
|
||||||
|
auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {return 3;});
|
||||||
|
auto values = o1.merge_delay_error(o2, o3);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](std::exception_ptr eptr) { printf("OnError %s\n", rxu::what(eptr).c_str()); },
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [merge_delay_error sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("implicit merge_delay_error sample"){
|
||||||
|
printf("//! [implicit merge_delay_error sample]\n");
|
||||||
|
auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(15)).map([](int) {return 1;});
|
||||||
|
auto o2 = rxcpp::observable<>::error<int>(std::runtime_error("Error from source\n"));
|
||||||
|
auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {return 3;});
|
||||||
|
auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
|
||||||
|
auto values = base.merge();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](std::exception_ptr eptr) { printf("OnError %s\n", rxu::what(eptr).c_str()); },
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [implicit merge_delay_error sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "main.hpp"
|
||||||
|
|
||||||
|
SCENARIO("threaded merge_delay_error sample"){
|
||||||
|
printf("//! [threaded merge_delay_error sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](long) -> long {
|
||||||
|
printf("[thread %s] Timer1 fired\n", get_pid().c_str());
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(20)).flat_map([](long) -> rxcpp::observable<long> {
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "[thread " << get_pid().c_str() << "] Timer2 failed\n";
|
||||||
|
printf("%s\n", ss.str().c_str());
|
||||||
|
ss.str(std::string());
|
||||||
|
ss << "(Error from thread: " << get_pid().c_str() << ")\n";
|
||||||
|
return rxcpp::observable<>::error<long>(std::runtime_error(ss.str()));
|
||||||
|
});
|
||||||
|
auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(30)).map([](long) -> long {
|
||||||
|
printf("[thread %s] Timer3 fired\n", get_pid().c_str());
|
||||||
|
return 3;
|
||||||
|
});
|
||||||
|
auto values = o1.merge(rxcpp::observe_on_new_thread(), o2, o3);
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("[thread %s] OnNext: %d\n", get_pid().c_str(), v);},
|
||||||
|
[](std::exception_ptr eptr) { printf("[thread %s] OnError %s\n", get_pid().c_str(), rxu::what(eptr).c_str()); },
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [threaded merge_delay_error sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded implicit merge_delay_error sample"){
|
||||||
|
printf("//! [threaded implicit merge_delay_error sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](long) -> long {
|
||||||
|
printf("[thread %s] Timer1 fired\n", get_pid().c_str());
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(20)).flat_map([](long) -> rxcpp::observable<long> {
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "[thread " << get_pid().c_str() << "] Timer2 failed\n";
|
||||||
|
printf("%s\n", ss.str().c_str());
|
||||||
|
ss.str(std::string());
|
||||||
|
ss << "(Error from thread: " << get_pid().c_str() << ")\n";
|
||||||
|
return rxcpp::observable<>::error<long>(std::runtime_error(ss.str()));
|
||||||
|
});
|
||||||
|
auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(30)).map([](long) -> long {
|
||||||
|
printf("[thread %s] Timer3 fired\n", get_pid().c_str());
|
||||||
|
return 3;
|
||||||
|
});
|
||||||
|
auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
|
||||||
|
auto values = base.merge(rxcpp::observe_on_new_thread());
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](long v){printf("[thread %s] OnNext: %ld\n", get_pid().c_str(), v);},
|
||||||
|
[](std::exception_ptr eptr) { printf("[thread %s] OnError %s\n", get_pid().c_str(), rxu::what(eptr).c_str()); },
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [threaded implicit merge_delay_error sample]\n");
|
||||||
|
}
|
15
3party/rxcpp/Rx/v2/examples/doxygen/never.cpp
Normal file
15
3party/rxcpp/Rx/v2/examples/doxygen/never.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("never sample"){
|
||||||
|
printf("//! [never sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::never<int>();
|
||||||
|
values.
|
||||||
|
take_until(std::chrono::steady_clock::now() + std::chrono::milliseconds(10)).
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [never sample]\n");
|
||||||
|
}
|
24
3party/rxcpp/Rx/v2/examples/doxygen/observe_on.cpp
Normal file
24
3party/rxcpp/Rx/v2/examples/doxygen/observe_on.cpp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
#include "main.hpp"
|
||||||
|
|
||||||
|
SCENARIO("observe_on sample"){
|
||||||
|
printf("//! [observe_on sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
map([](int v){
|
||||||
|
printf("[thread %s] Emit value %d\n", get_pid().c_str(), v);
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
values.
|
||||||
|
observe_on(rxcpp::synchronize_new_thread()).
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("[thread %s] OnNext: %d\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [observe_on sample]\n");
|
||||||
|
}
|
23
3party/rxcpp/Rx/v2/examples/doxygen/on_error_resume_next.cpp
Normal file
23
3party/rxcpp/Rx/v2/examples/doxygen/on_error_resume_next.cpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
namespace rxu=rxcpp::util;
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("on_error_resume_next sample"){
|
||||||
|
printf("//! [on_error_resume_next sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
|
||||||
|
on_error_resume_next([](std::exception_ptr ep){
|
||||||
|
printf("Resuming after: %s\n", rxu::what(ep).c_str());
|
||||||
|
return rxcpp::observable<>::just(-1);
|
||||||
|
});
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
printf("OnError: %s\n", rxu::what(ep).c_str());
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [on_error_resume_next sample]\n");
|
||||||
|
}
|
51
3party/rxcpp/Rx/v2/examples/doxygen/pairwise.cpp
Normal file
51
3party/rxcpp/Rx/v2/examples/doxygen/pairwise.cpp
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("pairwise sample"){
|
||||||
|
printf("//! [pairwise sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 5).pairwise();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](std::tuple<int, int> v){printf("OnNext: %d, %d\n", std::get<0>(v), std::get<1>(v));},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [pairwise sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("pairwise short sample"){
|
||||||
|
printf("//! [pairwise short sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::just(1).pairwise();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](std::tuple<int, int> v){printf("OnNext: %d, %d\n", std::get<0>(v), std::get<1>(v));},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [pairwise short sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
//#include "main.hpp"
|
||||||
|
//
|
||||||
|
//SCENARIO("threaded flat_map sample"){
|
||||||
|
// printf("//! [threaded flat_map sample]\n");
|
||||||
|
// printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
// auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
// flat_map(
|
||||||
|
// [](int v){
|
||||||
|
// printf("[thread %s] Call CollectionSelector(v = %d)\n", get_pid().c_str(), v);
|
||||||
|
// return
|
||||||
|
// rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(10 * v), std::chrono::milliseconds(50)).
|
||||||
|
// take(3);
|
||||||
|
// },
|
||||||
|
// [](int v_main, int v_sub){
|
||||||
|
// printf("[thread %s] Call ResultSelector(v_main = %d, v_sub = %d)\n", get_pid().c_str(), v_main, v_sub);
|
||||||
|
// return std::make_tuple(v_main, v_sub);
|
||||||
|
// },
|
||||||
|
// rxcpp::observe_on_new_thread());
|
||||||
|
// values.
|
||||||
|
// as_blocking().
|
||||||
|
// subscribe(
|
||||||
|
// [](std::tuple<int, long> v){printf("[thread %s] OnNext: %d - %d\n", get_pid().c_str(), std::get<0>(v), std::get<1>(v));},
|
||||||
|
// [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
// printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
// printf("//! [threaded flat_map sample]\n");
|
||||||
|
//}
|
192
3party/rxcpp/Rx/v2/examples/doxygen/publish.cpp
Normal file
192
3party/rxcpp/Rx/v2/examples/doxygen/publish.cpp
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
SCENARIO("publish_synchronized sample"){
|
||||||
|
printf("//! [publish_synchronized sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50)).
|
||||||
|
take(5).
|
||||||
|
publish_synchronized(rxcpp::observe_on_new_thread());
|
||||||
|
|
||||||
|
// Subscribe from the beginning
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[1] OnNext: %ld\n", v);},
|
||||||
|
[](){printf("[1] OnCompleted\n");});
|
||||||
|
|
||||||
|
// Another subscription from the beginning
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[2] OnNext: %ld\n", v);},
|
||||||
|
[](){printf("[2] OnCompleted\n");});
|
||||||
|
|
||||||
|
// Start emitting
|
||||||
|
values.connect();
|
||||||
|
|
||||||
|
// Wait before subscribing
|
||||||
|
rxcpp::observable<>::timer(std::chrono::milliseconds(75)).subscribe([&](long){
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[3] OnNext: %ld\n", v);},
|
||||||
|
[](){printf("[3] OnCompleted\n");});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add blocking subscription to see results
|
||||||
|
values.as_blocking().subscribe();
|
||||||
|
printf("//! [publish_synchronized sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("publish subject sample"){
|
||||||
|
printf("//! [publish subject sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50), rxcpp::observe_on_new_thread()).
|
||||||
|
take(5).
|
||||||
|
publish();
|
||||||
|
|
||||||
|
// Subscribe from the beginning
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[1] OnNext: %ld\n", v);},
|
||||||
|
[](){printf("[1] OnCompleted\n");});
|
||||||
|
|
||||||
|
// Another subscription from the beginning
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[2] OnNext: %ld\n", v);},
|
||||||
|
[](){printf("[2] OnCompleted\n");});
|
||||||
|
|
||||||
|
// Start emitting
|
||||||
|
values.connect();
|
||||||
|
|
||||||
|
// Wait before subscribing
|
||||||
|
rxcpp::observable<>::timer(std::chrono::milliseconds(75)).subscribe([&](long){
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[3] OnNext: %ld\n", v);},
|
||||||
|
[](){printf("[3] OnCompleted\n");});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add blocking subscription to see results
|
||||||
|
values.as_blocking().subscribe();
|
||||||
|
printf("//! [publish subject sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("publish behavior sample"){
|
||||||
|
printf("//! [publish behavior sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50), rxcpp::observe_on_new_thread()).
|
||||||
|
take(5).
|
||||||
|
publish(0L);
|
||||||
|
|
||||||
|
// Subscribe from the beginning
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[1] OnNext: %ld\n", v);},
|
||||||
|
[](){printf("[1] OnCompleted\n");});
|
||||||
|
|
||||||
|
// Another subscription from the beginning
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[2] OnNext: %ld\n", v);},
|
||||||
|
[](){printf("[2] OnCompleted\n");});
|
||||||
|
|
||||||
|
// Start emitting
|
||||||
|
values.connect();
|
||||||
|
|
||||||
|
// Wait before subscribing
|
||||||
|
rxcpp::observable<>::timer(std::chrono::milliseconds(75)).subscribe([&](long){
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[3] OnNext: %ld\n", v);},
|
||||||
|
[](){printf("[3] OnCompleted\n");});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add blocking subscription to see results
|
||||||
|
values.as_blocking().subscribe();
|
||||||
|
printf("//! [publish behavior sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("publish diamond bgthread sample"){
|
||||||
|
printf("//! [publish diamond bgthread sample]\n");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implements the following diamond graph chain with publish+connect on a background thread.
|
||||||
|
*
|
||||||
|
* Values
|
||||||
|
* / \
|
||||||
|
* *2 *100
|
||||||
|
* \ /
|
||||||
|
* Merge
|
||||||
|
*/
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50), rxcpp::observe_on_new_thread()).
|
||||||
|
take(5).
|
||||||
|
publish();
|
||||||
|
|
||||||
|
// Left side multiplies by 2.
|
||||||
|
auto left = values.map(
|
||||||
|
[](long v){printf("[1] OnNext: %ld -> %ld\n", v, v*2); return v * 2;} );
|
||||||
|
|
||||||
|
// Right side multiplies by 100.
|
||||||
|
auto right = values.map(
|
||||||
|
[](long v){printf("[2] OnNext: %ld -> %ld\n", v, v*100); return v * 100; });
|
||||||
|
|
||||||
|
// Merge the left,right sides together.
|
||||||
|
// The items are emitted interleaved ... [left1, right1, left2, right2, left3, right3, ...].
|
||||||
|
auto merged = left.merge(right);
|
||||||
|
|
||||||
|
std::atomic<bool> completed{false};
|
||||||
|
|
||||||
|
// Add subscription to see results
|
||||||
|
merged.subscribe(
|
||||||
|
[](long v) { printf("[3] OnNext: %ld\n", v); },
|
||||||
|
[&]() { printf("[3] OnCompleted:\n"); completed = true; });
|
||||||
|
|
||||||
|
// Start emitting
|
||||||
|
values.connect();
|
||||||
|
|
||||||
|
// Block until subscription terminates.
|
||||||
|
while (!completed) {}
|
||||||
|
|
||||||
|
// Note: consider using ref_count(other) in real code, it's more composable.
|
||||||
|
|
||||||
|
printf("//! [publish diamond bgthread sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("publish diamond samethread sample"){
|
||||||
|
printf("//! [publish diamond samethread sample]\n");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implements the following diamond graph chain with publish+connect diamond without using threads.
|
||||||
|
*
|
||||||
|
* Values
|
||||||
|
* / \
|
||||||
|
* *2 *100
|
||||||
|
* \ /
|
||||||
|
* Merge
|
||||||
|
*/
|
||||||
|
|
||||||
|
std::array<int, 5> a={{1, 2, 3, 4, 5}};
|
||||||
|
auto values = rxcpp::observable<>::iterate(a).
|
||||||
|
publish();
|
||||||
|
|
||||||
|
// Left side multiplies by 2.
|
||||||
|
auto left = values.map(
|
||||||
|
[](long v){printf("[1] OnNext: %ld -> %ld\n", v, v*2); return v * 2;} );
|
||||||
|
|
||||||
|
// Right side multiplies by 100.
|
||||||
|
auto right = values.map(
|
||||||
|
[](long v){printf("[2] OnNext: %ld -> %ld\n", v, v*100); return v * 100; });
|
||||||
|
|
||||||
|
// Merge the left,right sides together.
|
||||||
|
// The items are emitted interleaved ... [left1, right1, left2, right2, left3, right3, ...].
|
||||||
|
auto merged = left.merge(right);
|
||||||
|
|
||||||
|
// Add subscription to see results
|
||||||
|
merged.subscribe(
|
||||||
|
[](long v) { printf("[3] OnNext: %ld\n", v); },
|
||||||
|
[&]() { printf("[3] OnCompleted:\n"); });
|
||||||
|
|
||||||
|
// Start emitting
|
||||||
|
// - because there are no other threads here, the connect call blocks until the source
|
||||||
|
// calls on_completed.
|
||||||
|
values.connect();
|
||||||
|
|
||||||
|
// Note: consider using ref_count(other) in real code, it's more composable.
|
||||||
|
|
||||||
|
printf("//! [publish diamond samethread sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// see also examples/doxygen/ref_count.cpp for more diamond examples
|
152
3party/rxcpp/Rx/v2/examples/doxygen/range.cpp
Normal file
152
3party/rxcpp/Rx/v2/examples/doxygen/range.cpp
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("range sample"){
|
||||||
|
printf("//! [range sample]\n");
|
||||||
|
auto values1 = rxcpp::observable<>::range(1, 5);
|
||||||
|
values1.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [range sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "main.hpp"
|
||||||
|
|
||||||
|
SCENARIO("threaded range sample"){
|
||||||
|
printf("//! [threaded range sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3, rxcpp::observe_on_new_thread());
|
||||||
|
auto s = values.
|
||||||
|
map([](int v) { return std::make_tuple(get_pid(), v);});
|
||||||
|
s.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
rxcpp::util::apply_to(
|
||||||
|
[](const std::string pid, int v) {
|
||||||
|
printf("[thread %s] OnNext: %d\n", pid.c_str(), v);
|
||||||
|
}),
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [threaded range sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("subscribe_on range sample"){
|
||||||
|
printf("//! [subscribe_on range sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3);
|
||||||
|
auto s = values.
|
||||||
|
subscribe_on(rxcpp::observe_on_new_thread()).
|
||||||
|
map([](int v) { return std::make_tuple(get_pid(), v);});
|
||||||
|
s.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
rxcpp::util::apply_to(
|
||||||
|
[](const std::string pid, int v) {
|
||||||
|
printf("[thread %s] OnNext: %d\n", pid.c_str(), v);
|
||||||
|
}),
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [subscribe_on range sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SCENARIO("range concat sample"){
|
||||||
|
printf("//! [range concat sample]\n");
|
||||||
|
|
||||||
|
auto values = rxcpp::observable<>::range(1); // infinite (until overflow) stream of integers
|
||||||
|
|
||||||
|
auto s1 = values.
|
||||||
|
take(3).
|
||||||
|
map([](int v) { return std::make_tuple("1:", v);});
|
||||||
|
|
||||||
|
auto s2 = values.
|
||||||
|
take(3).
|
||||||
|
map([](int v) { return std::make_tuple("2:", v);});
|
||||||
|
|
||||||
|
s1.
|
||||||
|
concat(s2).
|
||||||
|
subscribe(rxcpp::util::apply_to(
|
||||||
|
[](const char* s, int p) {
|
||||||
|
printf("%s %d\n", s, p);
|
||||||
|
}));
|
||||||
|
printf("//! [range concat sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("range merge sample"){
|
||||||
|
printf("//! [range merge sample]\n");
|
||||||
|
|
||||||
|
auto values = rxcpp::observable<>::range(1); // infinite (until overflow) stream of integers
|
||||||
|
|
||||||
|
auto s1 = values.
|
||||||
|
map([](int v) { return std::make_tuple("1:", v);});
|
||||||
|
|
||||||
|
auto s2 = values.
|
||||||
|
map([](int v) { return std::make_tuple("2:", v);});
|
||||||
|
|
||||||
|
s1.
|
||||||
|
merge(s2).
|
||||||
|
take(6).
|
||||||
|
as_blocking().
|
||||||
|
subscribe(rxcpp::util::apply_to(
|
||||||
|
[](const char* s, int p) {
|
||||||
|
printf("%s %d\n", s, p);
|
||||||
|
}));
|
||||||
|
printf("//! [range merge sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded range concat sample"){
|
||||||
|
printf("//! [threaded range concat sample]\n");
|
||||||
|
auto threads = rxcpp::observe_on_event_loop();
|
||||||
|
|
||||||
|
auto values = rxcpp::observable<>::range(1); // infinite (until overflow) stream of integers
|
||||||
|
|
||||||
|
auto s1 = values.
|
||||||
|
subscribe_on(threads).
|
||||||
|
take(3).
|
||||||
|
map([](int v) { std::this_thread::yield(); return std::make_tuple("1:", v);});
|
||||||
|
|
||||||
|
auto s2 = values.
|
||||||
|
subscribe_on(threads).
|
||||||
|
take(3).
|
||||||
|
map([](int v) { std::this_thread::yield(); return std::make_tuple("2:", v);});
|
||||||
|
|
||||||
|
s1.
|
||||||
|
concat(s2).
|
||||||
|
observe_on(threads).
|
||||||
|
as_blocking().
|
||||||
|
subscribe(rxcpp::util::apply_to(
|
||||||
|
[](const char* s, int p) {
|
||||||
|
printf("%s %d\n", s, p);
|
||||||
|
}));
|
||||||
|
printf("//! [threaded range concat sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded range merge sample"){
|
||||||
|
printf("//! [threaded range merge sample]\n");
|
||||||
|
auto threads = rxcpp::observe_on_event_loop();
|
||||||
|
|
||||||
|
auto values = rxcpp::observable<>::range(1); // infinite (until overflow) stream of integers
|
||||||
|
|
||||||
|
auto s1 = values.
|
||||||
|
subscribe_on(threads).
|
||||||
|
map([](int v) { std::this_thread::yield(); return std::make_tuple("1:", v);});
|
||||||
|
|
||||||
|
auto s2 = values.
|
||||||
|
subscribe_on(threads).
|
||||||
|
map([](int v) { std::this_thread::yield(); return std::make_tuple("2:", v);});
|
||||||
|
|
||||||
|
s1.
|
||||||
|
merge(s2).
|
||||||
|
take(6).
|
||||||
|
observe_on(threads).
|
||||||
|
as_blocking().
|
||||||
|
subscribe(rxcpp::util::apply_to(
|
||||||
|
[](const char* s, int p) {
|
||||||
|
printf("%s %d\n", s, p);
|
||||||
|
}));
|
||||||
|
printf("//! [threaded range merge sample]\n");
|
||||||
|
}
|
||||||
|
|
85
3party/rxcpp/Rx/v2/examples/doxygen/reduce.cpp
Normal file
85
3party/rxcpp/Rx/v2/examples/doxygen/reduce.cpp
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("reduce sample"){
|
||||||
|
printf("//! [reduce sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 7).
|
||||||
|
reduce(
|
||||||
|
std::make_pair(0, 1.0),
|
||||||
|
[](std::pair<int, double> seed, int v){
|
||||||
|
seed.first += 1;
|
||||||
|
seed.second *= v;
|
||||||
|
return seed;
|
||||||
|
},
|
||||||
|
[](std::pair<int, double> res){
|
||||||
|
return std::pow(res.second, 1.0 / res.first);
|
||||||
|
});
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](double v){printf("OnNext: %lf\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [reduce sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("reduce empty sample"){
|
||||||
|
printf("//! [reduce empty sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::empty<int>().
|
||||||
|
reduce(
|
||||||
|
1,
|
||||||
|
[](int,int){return 0;},
|
||||||
|
[](int res){return res;});
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [reduce empty sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("reduce exception from accumulator sample"){
|
||||||
|
printf("//! [reduce exception from accumulator sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
reduce(
|
||||||
|
0,
|
||||||
|
[](int seed, int v){
|
||||||
|
if (v == 2)
|
||||||
|
throw std::runtime_error("Exception from accumulator");
|
||||||
|
return seed;
|
||||||
|
},
|
||||||
|
[](int res){return res;});
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
try {std::rethrow_exception(ep);}
|
||||||
|
catch (const std::exception& ex) {
|
||||||
|
printf("OnError: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [reduce exception from accumulator sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("reduce exception from result selector sample"){
|
||||||
|
printf("//! [reduce exception from result selector sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
reduce(
|
||||||
|
0,
|
||||||
|
[](int seed, int v){return seed + v;},
|
||||||
|
[](int res){
|
||||||
|
throw std::runtime_error("Exception from result selector");
|
||||||
|
return res;
|
||||||
|
});
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
try {std::rethrow_exception(ep);}
|
||||||
|
catch (const std::exception& ex) {
|
||||||
|
printf("OnError: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [reduce exception from result selector sample]\n");
|
||||||
|
}
|
55
3party/rxcpp/Rx/v2/examples/doxygen/ref_count.cpp
Normal file
55
3party/rxcpp/Rx/v2/examples/doxygen/ref_count.cpp
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
SCENARIO("ref_count other diamond sample"){
|
||||||
|
printf("//! [ref_count other diamond sample]\n");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implements the following diamond graph chain with publish+ref_count without using threads.
|
||||||
|
* This version is composable because it does not use connect explicitly.
|
||||||
|
*
|
||||||
|
* Values
|
||||||
|
* / \
|
||||||
|
* *2 *100
|
||||||
|
* \ /
|
||||||
|
* Merge
|
||||||
|
* |
|
||||||
|
* RefCount
|
||||||
|
*/
|
||||||
|
|
||||||
|
std::array<double, 5> a={{1.0, 2.0, 3.0, 4.0, 5.0}};
|
||||||
|
auto values = rxcpp::observable<>::iterate(a)
|
||||||
|
// The root of the chain is only subscribed to once.
|
||||||
|
.tap([](double v) { printf("[0] OnNext: %lf\n", v); })
|
||||||
|
.publish();
|
||||||
|
|
||||||
|
auto values_to_long = values.map([](double v) { return (long) v; });
|
||||||
|
|
||||||
|
// Left side multiplies by 2.
|
||||||
|
auto left = values_to_long.map(
|
||||||
|
[](long v) -> long {printf("[1] OnNext: %ld -> %ld\n", v, v*2); return v * 2L;} );
|
||||||
|
|
||||||
|
// Right side multiplies by 100.
|
||||||
|
auto right = values_to_long.map(
|
||||||
|
[](long v) -> long {printf("[2] OnNext: %ld -> %ld\n", v, v*100); return v * 100L; });
|
||||||
|
|
||||||
|
// Merge the left,right sides together.
|
||||||
|
// The items are emitted interleaved ... [left1, right1, left2, right2, left3, right3, ...].
|
||||||
|
auto merged = left.merge(right);
|
||||||
|
|
||||||
|
// When this value is subscribed to, it calls connect on values.
|
||||||
|
auto connect_on_subscribe = merged.ref_count(values);
|
||||||
|
|
||||||
|
// This immediately starts emitting all values and blocks until they are completed.
|
||||||
|
connect_on_subscribe.subscribe(
|
||||||
|
[](long v) { printf("[3] OnNext: %ld\n", v); },
|
||||||
|
[&]() { printf("[3] OnCompleted:\n"); });
|
||||||
|
|
||||||
|
printf("//! [ref_count other diamond sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// see also examples/doxygen/publish.cpp for non-ref_count diamonds
|
44
3party/rxcpp/Rx/v2/examples/doxygen/repeat.cpp
Normal file
44
3party/rxcpp/Rx/v2/examples/doxygen/repeat.cpp
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("repeat sample"){
|
||||||
|
printf("//! [repeat sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::from(1, 2).
|
||||||
|
repeat().
|
||||||
|
take(5);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [repeat sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("repeat count sample"){
|
||||||
|
printf("//! [repeat count sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::from(1, 2).repeat(3);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [repeat count sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("repeat error sample"){
|
||||||
|
printf("//! [repeat error sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::from(1, 2).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
|
||||||
|
repeat();
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
try {std::rethrow_exception(ep);}
|
||||||
|
catch (const std::exception& ex) {
|
||||||
|
printf("OnError: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [repeat error sample]\n");
|
||||||
|
}
|
234
3party/rxcpp/Rx/v2/examples/doxygen/replay.cpp
Normal file
234
3party/rxcpp/Rx/v2/examples/doxygen/replay.cpp
Normal file
@ -0,0 +1,234 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
#include "main.hpp"
|
||||||
|
|
||||||
|
SCENARIO("replay sample"){
|
||||||
|
printf("//! [replay sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50), rxcpp::observe_on_new_thread()).
|
||||||
|
take(5).
|
||||||
|
replay();
|
||||||
|
|
||||||
|
// Subscribe from the beginning
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[1] OnNext: %ld\n", v);},
|
||||||
|
[](){printf("[1] OnCompleted\n");});
|
||||||
|
|
||||||
|
// Start emitting
|
||||||
|
values.connect();
|
||||||
|
|
||||||
|
// Wait before subscribing
|
||||||
|
rxcpp::observable<>::timer(std::chrono::milliseconds(125)).subscribe([&](long){
|
||||||
|
values.as_blocking().subscribe(
|
||||||
|
[](long v){printf("[2] OnNext: %ld\n", v);},
|
||||||
|
[](){printf("[2] OnCompleted\n");});
|
||||||
|
});
|
||||||
|
printf("//! [replay sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded replay sample"){
|
||||||
|
printf("//! [threaded replay sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto coordination = rxcpp::serialize_new_thread();
|
||||||
|
auto worker = coordination.create_coordinator().get_worker();
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50)).
|
||||||
|
take(5).
|
||||||
|
replay(coordination);
|
||||||
|
|
||||||
|
// Subscribe from the beginning
|
||||||
|
worker.schedule([&](const rxcpp::schedulers::schedulable&){
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[thread %s][1] OnNext: %ld\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s][1] OnCompleted\n", get_pid().c_str());});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Wait before subscribing
|
||||||
|
worker.schedule(coordination.now() + std::chrono::milliseconds(125), [&](const rxcpp::schedulers::schedulable&){
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[thread %s][2] OnNext: %ld\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s][2] OnCompleted\n", get_pid().c_str());});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Start emitting
|
||||||
|
worker.schedule([&](const rxcpp::schedulers::schedulable&){
|
||||||
|
values.connect();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add blocking subscription to see results
|
||||||
|
values.as_blocking().subscribe();
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [threaded replay sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("replay count sample"){
|
||||||
|
printf("//! [replay count sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50), rxcpp::observe_on_new_thread()).
|
||||||
|
take(5).
|
||||||
|
replay(2);
|
||||||
|
|
||||||
|
// Subscribe from the beginning
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[1] OnNext: %ld\n", v);},
|
||||||
|
[](){printf("[1] OnCompleted\n");});
|
||||||
|
|
||||||
|
// Start emitting
|
||||||
|
values.connect();
|
||||||
|
|
||||||
|
// Wait before subscribing
|
||||||
|
rxcpp::observable<>::timer(std::chrono::milliseconds(125)).subscribe([&](long){
|
||||||
|
values.as_blocking().subscribe(
|
||||||
|
[](long v){printf("[2] OnNext: %ld\n", v);},
|
||||||
|
[](){printf("[2] OnCompleted\n");});
|
||||||
|
});
|
||||||
|
printf("//! [replay count sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded replay count sample"){
|
||||||
|
printf("//! [threaded replay count sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto coordination = rxcpp::serialize_new_thread();
|
||||||
|
auto worker = coordination.create_coordinator().get_worker();
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50)).
|
||||||
|
take(5).
|
||||||
|
replay(2, coordination);
|
||||||
|
|
||||||
|
// Subscribe from the beginning
|
||||||
|
worker.schedule([&](const rxcpp::schedulers::schedulable&){
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[thread %s][1] OnNext: %ld\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s][1] OnCompleted\n", get_pid().c_str());});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Wait before subscribing
|
||||||
|
worker.schedule(coordination.now() + std::chrono::milliseconds(125), [&](const rxcpp::schedulers::schedulable&){
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[thread %s][2] OnNext: %ld\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s][2] OnCompleted\n", get_pid().c_str());});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Start emitting
|
||||||
|
worker.schedule([&](const rxcpp::schedulers::schedulable&){
|
||||||
|
values.connect();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add blocking subscription to see results
|
||||||
|
values.as_blocking().subscribe();
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [threaded replay count sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("replay period sample"){
|
||||||
|
printf("//! [replay period sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50), rxcpp::observe_on_new_thread()).
|
||||||
|
take(5).
|
||||||
|
replay(std::chrono::milliseconds(125));
|
||||||
|
|
||||||
|
// Subscribe from the beginning
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[1] OnNext: %ld\n", v);},
|
||||||
|
[](){printf("[1] OnCompleted\n");});
|
||||||
|
|
||||||
|
// Start emitting
|
||||||
|
values.connect();
|
||||||
|
|
||||||
|
// Wait before subscribing
|
||||||
|
rxcpp::observable<>::timer(std::chrono::milliseconds(175)).subscribe([&](long){
|
||||||
|
values.as_blocking().subscribe(
|
||||||
|
[](long v){printf("[2] OnNext: %ld\n", v);},
|
||||||
|
[](){printf("[2] OnCompleted\n");});
|
||||||
|
});
|
||||||
|
printf("//! [replay period sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded replay period sample"){
|
||||||
|
printf("//! [threaded replay period sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto coordination = rxcpp::serialize_new_thread();
|
||||||
|
auto worker = coordination.create_coordinator().get_worker();
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50)).
|
||||||
|
take(5).
|
||||||
|
replay(std::chrono::milliseconds(125), coordination);
|
||||||
|
|
||||||
|
// Subscribe from the beginning
|
||||||
|
worker.schedule([&](const rxcpp::schedulers::schedulable&){
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[thread %s][1] OnNext: %ld\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s][1] OnCompleted\n", get_pid().c_str());});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Wait before subscribing
|
||||||
|
worker.schedule(coordination.now() + std::chrono::milliseconds(175), [&](const rxcpp::schedulers::schedulable&){
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[thread %s][2] OnNext: %ld\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s][2] OnCompleted\n", get_pid().c_str());});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Start emitting
|
||||||
|
worker.schedule([&](const rxcpp::schedulers::schedulable&){
|
||||||
|
values.connect();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add blocking subscription to see results
|
||||||
|
values.as_blocking().subscribe();
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [threaded replay period sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("replay count+period sample"){
|
||||||
|
printf("//! [replay count+period sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50), rxcpp::observe_on_new_thread()).
|
||||||
|
take(5).
|
||||||
|
replay(2, std::chrono::milliseconds(125));
|
||||||
|
|
||||||
|
// Subscribe from the beginning
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[1] OnNext: %ld\n", v);},
|
||||||
|
[](){printf("[1] OnCompleted\n");});
|
||||||
|
|
||||||
|
// Start emitting
|
||||||
|
values.connect();
|
||||||
|
|
||||||
|
// Wait before subscribing
|
||||||
|
rxcpp::observable<>::timer(std::chrono::milliseconds(175)).subscribe([&](long){
|
||||||
|
values.as_blocking().subscribe(
|
||||||
|
[](long v){printf("[2] OnNext: %ld\n", v);},
|
||||||
|
[](){printf("[2] OnCompleted\n");});
|
||||||
|
});
|
||||||
|
printf("//! [replay count+period sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded replay count+period sample"){
|
||||||
|
printf("//! [threaded replay count+period sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto coordination = rxcpp::serialize_new_thread();
|
||||||
|
auto worker = coordination.create_coordinator().get_worker();
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50)).
|
||||||
|
take(5).
|
||||||
|
replay(2, std::chrono::milliseconds(125), coordination);
|
||||||
|
|
||||||
|
// Subscribe from the beginning
|
||||||
|
worker.schedule([&](const rxcpp::schedulers::schedulable&){
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[thread %s][1] OnNext: %ld\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s][1] OnCompleted\n", get_pid().c_str());});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Wait before subscribing
|
||||||
|
worker.schedule(coordination.now() + std::chrono::milliseconds(175), [&](const rxcpp::schedulers::schedulable&){
|
||||||
|
values.subscribe(
|
||||||
|
[](long v){printf("[thread %s][2] OnNext: %ld\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s][2] OnCompleted\n", get_pid().c_str());});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Start emitting
|
||||||
|
worker.schedule([&](const rxcpp::schedulers::schedulable&){
|
||||||
|
values.connect();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add blocking subscription to see results
|
||||||
|
values.as_blocking().subscribe();
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [threaded replay count+period sample]\n");
|
||||||
|
}
|
84
3party/rxcpp/Rx/v2/examples/doxygen/retry.cpp
Normal file
84
3party/rxcpp/Rx/v2/examples/doxygen/retry.cpp
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("retry sample"){
|
||||||
|
printf("//! [retry sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::from(1, 2).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
|
||||||
|
retry().
|
||||||
|
take(5);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [retry sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("retry count sample"){
|
||||||
|
printf("//! [retry count sample]\n");
|
||||||
|
auto source = rxcpp::observable<>::from(1, 2).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source")));
|
||||||
|
auto values = source.retry(3);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
try {std::rethrow_exception(ep);}
|
||||||
|
catch (const std::exception& ex) {
|
||||||
|
printf("OnError: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [retry count sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
//SCENARIO("retry hot sample"){
|
||||||
|
// printf("//! [retry hot sample]\n");
|
||||||
|
// auto values = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).
|
||||||
|
// concat(rxcpp::observable<>::error<long>(std::runtime_error("Error1 from source"))).
|
||||||
|
// concat(rxcpp::observable<>::timer(std::chrono::milliseconds(10))).
|
||||||
|
// concat(rxcpp::observable<>::error<long>(std::runtime_error("Error2 from source"))).
|
||||||
|
// concat(rxcpp::observable<>::timer(std::chrono::milliseconds(10))).
|
||||||
|
// concat(rxcpp::observable<>::error<long>(std::runtime_error("Error3 from source"))).
|
||||||
|
// concat(rxcpp::observable<>::timer(std::chrono::milliseconds(10))).
|
||||||
|
// concat(rxcpp::observable<>::error<long>(std::runtime_error("Error4 from source"))).
|
||||||
|
// retry(3);
|
||||||
|
// values.
|
||||||
|
// subscribe(
|
||||||
|
// [](long v){printf("OnNext: %d\n", v);},
|
||||||
|
// [](std::exception_ptr ep){
|
||||||
|
// try {std::rethrow_exception(ep);}
|
||||||
|
// catch (const std::exception& ex) {
|
||||||
|
// printf("OnError: %s\n", ex.what());
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// [](){printf("OnCompleted\n");});
|
||||||
|
// printf("//! [retry hot sample]\n");
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//SCENARIO("retry completed sample"){
|
||||||
|
// printf("//! [retry completed sample <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]\n");
|
||||||
|
// auto source = rxcpp::observable<>::from(1, 2).
|
||||||
|
// concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
|
||||||
|
// publish();
|
||||||
|
// auto values = source.retry();
|
||||||
|
// //auto values = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).
|
||||||
|
// // concat(rxcpp::observable<>::error<long>(std::runtime_error("Error1 from source"))).
|
||||||
|
// // concat(rxcpp::observable<>::timer(std::chrono::milliseconds(10))).
|
||||||
|
// // concat(rxcpp::observable<>::error<long>(std::runtime_error("Error2 from source"))).
|
||||||
|
// // concat(rxcpp::observable<>::timer(std::chrono::milliseconds(10))).
|
||||||
|
// // retry(3);
|
||||||
|
// values.
|
||||||
|
// subscribe(
|
||||||
|
// [](long v){printf("OnNext: %d\n", v);},
|
||||||
|
// [](std::exception_ptr ep){
|
||||||
|
// try {std::rethrow_exception(ep);}
|
||||||
|
// catch (const std::exception& ex) {
|
||||||
|
// printf("OnError: %s\n", ex.what());
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// [](){printf("OnCompleted\n");});
|
||||||
|
// printf("//! [retry completed sample]\n");
|
||||||
|
//}
|
18
3party/rxcpp/Rx/v2/examples/doxygen/sample.cpp
Normal file
18
3party/rxcpp/Rx/v2/examples/doxygen/sample.cpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("sample period sample") {
|
||||||
|
printf("//! [sample period sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(2)).
|
||||||
|
take(7).
|
||||||
|
sample_with_time(std::chrono::milliseconds(4));
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](long v) {
|
||||||
|
printf("OnNext: %ld\n", v);
|
||||||
|
},
|
||||||
|
[]() { printf("OnCompleted\n"); });
|
||||||
|
printf("//! [sample period sample]\n");
|
||||||
|
}
|
19
3party/rxcpp/Rx/v2/examples/doxygen/scan.cpp
Normal file
19
3party/rxcpp/Rx/v2/examples/doxygen/scan.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("scan sample"){
|
||||||
|
printf("//! [scan sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 7).
|
||||||
|
scan(
|
||||||
|
0,
|
||||||
|
[](int seed, int v){
|
||||||
|
return seed + v;
|
||||||
|
});
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [scan sample]\n");
|
||||||
|
}
|
17
3party/rxcpp/Rx/v2/examples/doxygen/scope.cpp
Normal file
17
3party/rxcpp/Rx/v2/examples/doxygen/scope.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("scope sample"){
|
||||||
|
printf("//! [scope sample]\n");
|
||||||
|
typedef rxcpp::resource<std::vector<int>> resource;
|
||||||
|
auto resource_factory = [](){return resource(rxcpp::util::to_vector({1, 2, 3, 4, 5}));};
|
||||||
|
auto observable_factory = [](resource res){return rxcpp::observable<>::iterate(res.get());};
|
||||||
|
auto values = rxcpp::observable<>::scope(resource_factory, observable_factory);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [scope sample]\n");
|
||||||
|
}
|
15
3party/rxcpp/Rx/v2/examples/doxygen/sequence_equal.cpp
Normal file
15
3party/rxcpp/Rx/v2/examples/doxygen/sequence_equal.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("sequence_equal sample"){
|
||||||
|
printf("//! [sequence_equal sample]\n");
|
||||||
|
auto source = rxcpp::observable<>::range(1, 3);
|
||||||
|
auto values = source.sequence_equal(rxcpp::observable<>::range(1, 3));
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](bool v){ printf("OnNext: %s\n", v ? "true" : "false"); },
|
||||||
|
[](){ printf("OnCompleted\n");} );
|
||||||
|
printf("//! [sequence_equal sample]\n");
|
||||||
|
}
|
14
3party/rxcpp/Rx/v2/examples/doxygen/skip.cpp
Normal file
14
3party/rxcpp/Rx/v2/examples/doxygen/skip.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("skip sample"){
|
||||||
|
printf("//! [skip sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 7).skip(3);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [skip sample]\n");
|
||||||
|
}
|
14
3party/rxcpp/Rx/v2/examples/doxygen/skip_last.cpp
Normal file
14
3party/rxcpp/Rx/v2/examples/doxygen/skip_last.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("skip_last sample"){
|
||||||
|
printf("//! [skip_last sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 7).skip_last(3);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [skip_last sample]\n");
|
||||||
|
}
|
39
3party/rxcpp/Rx/v2/examples/doxygen/skip_until.cpp
Normal file
39
3party/rxcpp/Rx/v2/examples/doxygen/skip_until.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("skip_until sample"){
|
||||||
|
printf("//! [skip_until sample]\n");
|
||||||
|
auto source = rxcpp::observable<>::interval(std::chrono::milliseconds(10)).take(7);
|
||||||
|
auto trigger = rxcpp::observable<>::timer(std::chrono::milliseconds(25));
|
||||||
|
auto values = source.skip_until(trigger);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](long v){printf("OnNext: %ld\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [skip_until sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "main.hpp"
|
||||||
|
|
||||||
|
SCENARIO("threaded skip_until sample"){
|
||||||
|
printf("//! [threaded skip_until sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto source = rxcpp::observable<>::interval(std::chrono::milliseconds(10)).take(7).map([](long v){
|
||||||
|
printf("[thread %s] Source emits, value = %ld\n", get_pid().c_str(), v);
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
auto trigger = rxcpp::observable<>::timer(std::chrono::milliseconds(25)).map([](long v){
|
||||||
|
printf("[thread %s] Trigger emits, value = %ld\n", get_pid().c_str(), v);
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
auto values = source.skip_until(trigger, rxcpp::observe_on_new_thread());
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](long v){printf("[thread %s] OnNext: %ld\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [threaded skip_until sample]\n");
|
||||||
|
}
|
17
3party/rxcpp/Rx/v2/examples/doxygen/skip_while.cpp
Normal file
17
3party/rxcpp/Rx/v2/examples/doxygen/skip_while.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("skip_while sample"){
|
||||||
|
printf("//! [skip_while sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 8).
|
||||||
|
skip_while([](int v){
|
||||||
|
return v <= 4;
|
||||||
|
});
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [skip_while sample]\n");
|
||||||
|
}
|
26
3party/rxcpp/Rx/v2/examples/doxygen/start_with.cpp
Normal file
26
3party/rxcpp/Rx/v2/examples/doxygen/start_with.cpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("full start_with sample"){
|
||||||
|
printf("//! [full start_with sample]\n");
|
||||||
|
auto observable = rxcpp::observable<>::range(10, 12);
|
||||||
|
auto values = rxcpp::observable<>::start_with(observable, 1, 2, 3);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [full start_with sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("short start_with sample"){
|
||||||
|
printf("//! [short start_with sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(10, 12).
|
||||||
|
start_with(1, 2, 3);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [short start_with sample]\n");
|
||||||
|
}
|
101
3party/rxcpp/Rx/v2/examples/doxygen/subscribe.cpp
Normal file
101
3party/rxcpp/Rx/v2/examples/doxygen/subscribe.cpp
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("subscribe by subscriber"){
|
||||||
|
printf("//! [subscribe by subscriber]\n");
|
||||||
|
auto subscriber = rxcpp::make_subscriber<int>(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3);
|
||||||
|
values.subscribe(subscriber);
|
||||||
|
printf("//! [subscribe by subscriber]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("subscribe by observer"){
|
||||||
|
printf("//! [subscribe by observer]\n");
|
||||||
|
auto subscriber = rxcpp::make_subscriber<int>(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
auto values1 = rxcpp::observable<>::range(1, 3);
|
||||||
|
auto values2 = rxcpp::observable<>::range(4, 6);
|
||||||
|
values1.subscribe(subscriber.get_observer());
|
||||||
|
values2.subscribe(subscriber.get_observer());
|
||||||
|
printf("//! [subscribe by observer]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("subscribe by on_next"){
|
||||||
|
printf("//! [subscribe by on_next]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3);
|
||||||
|
values.subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);});
|
||||||
|
printf("//! [subscribe by on_next]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("subscribe by on_next and on_error"){
|
||||||
|
printf("//! [subscribe by on_next and on_error]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source")));
|
||||||
|
values.subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
try {std::rethrow_exception(ep);}
|
||||||
|
catch (const std::exception& ex) {
|
||||||
|
printf("OnError: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
printf("//! [subscribe by on_next and on_error]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("subscribe by on_next and on_completed"){
|
||||||
|
printf("//! [subscribe by on_next and on_completed]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3);
|
||||||
|
values.subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [subscribe by on_next and on_completed]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("subscribe by subscription, on_next, and on_completed"){
|
||||||
|
printf("//! [subscribe by subscription, on_next, and on_completed]\n");
|
||||||
|
auto subscription = rxcpp::composite_subscription();
|
||||||
|
auto values = rxcpp::observable<>::range(1, 5);
|
||||||
|
values.subscribe(
|
||||||
|
subscription,
|
||||||
|
[&subscription](int v){
|
||||||
|
printf("OnNext: %d\n", v);
|
||||||
|
if (v == 3)
|
||||||
|
subscription.unsubscribe();
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [subscribe by subscription, on_next, and on_completed]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("subscribe by on_next, on_error, and on_completed"){
|
||||||
|
printf("//! [subscribe by on_next, on_error, and on_completed]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source")));
|
||||||
|
values.subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](std::exception_ptr ep){
|
||||||
|
try {std::rethrow_exception(ep);}
|
||||||
|
catch (const std::exception& ex) {
|
||||||
|
printf("OnError: %s\n", ex.what());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [subscribe by on_next, on_error, and on_completed]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("subscribe unsubscribe"){
|
||||||
|
printf("//! [subscribe unsubscribe]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
concat(rxcpp::observable<>::never<int>()).
|
||||||
|
finally([](){printf("The final action\n");});
|
||||||
|
auto subscription = values.subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
subscription.unsubscribe();
|
||||||
|
printf("//! [subscribe unsubscribe]\n");
|
||||||
|
}
|
24
3party/rxcpp/Rx/v2/examples/doxygen/subscribe_on.cpp
Normal file
24
3party/rxcpp/Rx/v2/examples/doxygen/subscribe_on.cpp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
#include "main.hpp"
|
||||||
|
|
||||||
|
SCENARIO("subscribe_on sample"){
|
||||||
|
printf("//! [subscribe_on sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto values = rxcpp::observable<>::range(1, 3).
|
||||||
|
map([](int v){
|
||||||
|
printf("[thread %s] Emit value %d\n", get_pid().c_str(), v);
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
values.
|
||||||
|
subscribe_on(rxcpp::synchronize_new_thread()).
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("[thread %s] OnNext: %d\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [subscribe_on sample]\n");
|
||||||
|
}
|
33
3party/rxcpp/Rx/v2/examples/doxygen/switch_if_empty.cpp
Normal file
33
3party/rxcpp/Rx/v2/examples/doxygen/switch_if_empty.cpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("switch_if_empty sample"){
|
||||||
|
printf("//! [switch_if_empty sample]\n");
|
||||||
|
|
||||||
|
auto values = rxcpp::observable<>::empty<int>()
|
||||||
|
.switch_if_empty(rxcpp::observable<>::range(1, 5));
|
||||||
|
|
||||||
|
values.subscribe(
|
||||||
|
[](int v) { printf("OnNext: %d\n", v); },
|
||||||
|
[]() { printf("OnCompleted\n"); } );
|
||||||
|
|
||||||
|
printf("//! [switch_if_empty sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("switch_if_empty - operator syntax sample") {
|
||||||
|
using namespace rxcpp;
|
||||||
|
using namespace rxcpp::sources;
|
||||||
|
using namespace rxcpp::operators;
|
||||||
|
|
||||||
|
printf("//! [switch_if_empty - operator syntax sample]\n");
|
||||||
|
auto values = empty<int>()
|
||||||
|
| switch_if_empty(range(1, 5));
|
||||||
|
|
||||||
|
values.subscribe(
|
||||||
|
[](int v) { printf("OnNext: %d\n", v); },
|
||||||
|
[]() { printf("OnCompleted\n"); } );
|
||||||
|
|
||||||
|
printf("//! [switch_if_empty - operator syntax sample]\n");
|
||||||
|
}
|
35
3party/rxcpp/Rx/v2/examples/doxygen/switch_on_next.cpp
Normal file
35
3party/rxcpp/Rx/v2/examples/doxygen/switch_on_next.cpp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("switch_on_next sample"){
|
||||||
|
printf("//! [switch_on_next sample]\n");
|
||||||
|
auto base = rxcpp::observable<>::interval(std::chrono::milliseconds(30)).
|
||||||
|
take(3).
|
||||||
|
map([](long){
|
||||||
|
return rxcpp::observable<>::interval(std::chrono::milliseconds(10)).as_dynamic();
|
||||||
|
});
|
||||||
|
auto values = base.switch_on_next().take(10);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](long v){printf("OnNext: %ld\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [switch_on_next sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded switch_on_next sample"){
|
||||||
|
printf("//! [threaded switch_on_next sample]\n");
|
||||||
|
auto base = rxcpp::observable<>::interval(std::chrono::milliseconds(30)).
|
||||||
|
take(3).
|
||||||
|
map([](long){
|
||||||
|
return rxcpp::observable<>::interval(std::chrono::milliseconds(10), rxcpp::observe_on_event_loop()).as_dynamic();
|
||||||
|
});
|
||||||
|
auto values = base.switch_on_next(rxcpp::observe_on_new_thread()).take(10);
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](long v){printf("OnNext: %ld\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [threaded switch_on_next sample]\n");
|
||||||
|
}
|
15
3party/rxcpp/Rx/v2/examples/doxygen/take.cpp
Normal file
15
3party/rxcpp/Rx/v2/examples/doxygen/take.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
SCENARIO("take sample"){
|
||||||
|
printf("//! [take sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 7).take(3);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [take sample]\n");
|
||||||
|
}
|
15
3party/rxcpp/Rx/v2/examples/doxygen/take_last.cpp
Normal file
15
3party/rxcpp/Rx/v2/examples/doxygen/take_last.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
SCENARIO("take_last sample"){
|
||||||
|
printf("//! [take_last sample]\n");
|
||||||
|
auto values = rxcpp::observable<>::range(1, 7).take_last(3);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](int v){printf("OnNext: %d\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [take_last sample]\n");
|
||||||
|
}
|
68
3party/rxcpp/Rx/v2/examples/doxygen/take_until.cpp
Normal file
68
3party/rxcpp/Rx/v2/examples/doxygen/take_until.cpp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#include "rxcpp/rx.hpp"
|
||||||
|
|
||||||
|
#include "rxcpp/rx-test.hpp"
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
SCENARIO("take_until sample"){
|
||||||
|
printf("//! [take_until sample]\n");
|
||||||
|
auto source = rxcpp::observable<>::interval(std::chrono::milliseconds(10)).take(7);
|
||||||
|
auto trigger = rxcpp::observable<>::timer(std::chrono::milliseconds(25));
|
||||||
|
auto values = source.take_until(trigger);
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](long v){printf("OnNext: %ld\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [take_until sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("take_until time sample"){
|
||||||
|
printf("//! [take_until time sample]\n");
|
||||||
|
auto source = rxcpp::observable<>::interval(std::chrono::milliseconds(10)).take(7);
|
||||||
|
auto values = source.take_until(std::chrono::steady_clock::now() + std::chrono::milliseconds(25));
|
||||||
|
values.
|
||||||
|
subscribe(
|
||||||
|
[](long v){printf("OnNext: %ld\n", v);},
|
||||||
|
[](){printf("OnCompleted\n");});
|
||||||
|
printf("//! [take_until time sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "main.hpp"
|
||||||
|
|
||||||
|
SCENARIO("threaded take_until sample"){
|
||||||
|
printf("//! [threaded take_until sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto source = rxcpp::observable<>::interval(std::chrono::milliseconds(10)).take(7).map([](long v){
|
||||||
|
printf("[thread %s] Source emits, value = %ld\n", get_pid().c_str(), v);
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
auto trigger = rxcpp::observable<>::timer(std::chrono::milliseconds(25)).map([](long v){
|
||||||
|
printf("[thread %s] Trigger emits, value = %ld\n", get_pid().c_str(), v);
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
auto values = source.take_until(trigger, rxcpp::observe_on_new_thread());
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](long v){printf("[thread %s] OnNext: %ld\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [threaded take_until sample]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("threaded take_until time sample"){
|
||||||
|
printf("//! [threaded take_until time sample]\n");
|
||||||
|
printf("[thread %s] Start task\n", get_pid().c_str());
|
||||||
|
auto source = rxcpp::observable<>::interval(std::chrono::milliseconds(10)).take(7).map([](long v){
|
||||||
|
printf("[thread %s] Source emits, value = %ld\n", get_pid().c_str(), v);
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
auto scheduler = rxcpp::observe_on_new_thread();
|
||||||
|
auto values = source.take_until(scheduler.now() + std::chrono::milliseconds(25), scheduler);
|
||||||
|
values.
|
||||||
|
as_blocking().
|
||||||
|
subscribe(
|
||||||
|
[](long v){printf("[thread %s] OnNext: %ld\n", get_pid().c_str(), v);},
|
||||||
|
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
|
||||||
|
printf("[thread %s] Finish task\n", get_pid().c_str());
|
||||||
|
printf("//! [threaded take_until time sample]\n");
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user