123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360 |
- /*
- * WARNING: Auto-generated file (5/1/2015 21:21:20)
- * Run Rx's auto-homoiconizer tool to generate this file (in the HomoIcon directory).
- */
- #pragma warning disable 1591
- using System;
- using System.Reactive.Concurrency;
- using System.Collections.Generic;
- using System.Reactive.Joins;
- using System.Linq;
- using System.Linq.Expressions;
- using System.Reflection;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Reactive;
- using System.Reactive.Subjects;
- namespace System.Reactive.Linq
- {
- public static partial class QbservableEx
- {
- #if !STABLE
- /// <summary>
- /// Subscribes to each observable sequence returned by the iteratorMethod in sequence and produces a Unit value on the resulting sequence for each step of the iteration.
- /// </summary>
- /// <param name="provider">Query provider used to construct the <see cref="IQbservable{T}"/> data source.</param>
- /// <param name="iteratorMethod">Iterator method that drives the resulting observable sequence.</param>
- /// <returns>An observable sequence obtained by running the iterator and returning Unit values for each iteration step.</returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="iteratorMethod" /> is null.</exception>
- [Experimental]
- public static IQbservable<Unit> Create(this IQbservableProvider provider, Expression<Func<IEnumerable<IObservable<object>>>> iteratorMethod)
- {
- if (provider == null)
- throw new ArgumentNullException(nameof(provider));
- if (iteratorMethod == null)
- throw new ArgumentNullException(nameof(iteratorMethod));
-
- return provider.CreateQuery<Unit>(
- Expression.Call(
- null,
- #if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.Create(default(IQbservableProvider), default(Expression<Func<IEnumerable<IObservable<object>>>>))),
- #else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
- #endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- iteratorMethod
- )
- );
- }
- #endif
-
- #if !STABLE
- /// <summary>
- /// Subscribes to each observable sequence returned by the iteratorMethod in sequence and returns the observable sequence of values sent to the observer given to the iteratorMethod.
- /// </summary>
- /// <param name="provider">Query provider used to construct the <see cref="IQbservable{T}"/> data source.</param>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="iteratorMethod">Iterator method that produces elements in the resulting sequence by calling the given observer.</param>
- /// <returns>An observable sequence obtained by running the iterator and returning the elements that were sent to the observer.</returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="iteratorMethod" /> is null.</exception>
- [Experimental]
- public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, IEnumerable<IObservable<object>>>> iteratorMethod)
- {
- if (provider == null)
- throw new ArgumentNullException(nameof(provider));
- if (iteratorMethod == null)
- throw new ArgumentNullException(nameof(iteratorMethod));
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
- #if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, IEnumerable<IObservable<object>>>>))),
- #else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
- #endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- iteratorMethod
- )
- );
- }
- #endif
-
- #if !STABLE
- /// <summary>
- /// Expands an observable sequence by recursively invoking selector.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and each of the recursively expanded sources obtained by running the selector function.</typeparam>
- /// <param name="source">Source sequence with the initial elements.</param>
- /// <param name="selector">Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.</param>
- /// <returns>An observable sequence containing all the elements produced by the recursive expansion.</returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- [Experimental]
- public static IQbservable<TSource> Expand<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TSource>>> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
- #if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.Expand<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TSource>>>))),
- #else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
- #endif
- source.Expression,
- selector
- )
- );
- }
- #endif
-
- #if !STABLE
- /// <summary>
- /// Expands an observable sequence by recursively invoking selector, using the specified scheduler to enumerate the queue of obtained sequences.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and each of the recursively expanded sources obtained by running the selector function.</typeparam>
- /// <param name="source">Source sequence with the initial elements.</param>
- /// <param name="selector">Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.</param>
- /// <param name="scheduler">Scheduler on which to perform the expansion by enumerating the internal queue of obtained sequences.</param>
- /// <returns>An observable sequence containing all the elements produced by the recursive expansion.</returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> or <paramref name="scheduler" /> is null.</exception>
- [Experimental]
- public static IQbservable<TSource> Expand<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TSource>>> selector, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- if (scheduler == null)
- throw new ArgumentNullException(nameof(scheduler));
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
- #if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.Expand<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TSource>>>), default(IScheduler))),
- #else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
- #endif
- source.Expression,
- selector,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
- #endif
-
- #if !STABLE
- /// <summary>
- /// Runs all specified observable sequences in parallel and collects their last elements.
- /// </summary>
- /// <param name="provider">Query provider used to construct the <see cref="IQbservable{T}"/> data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequence to collect the last elements for.</param>
- /// <returns>An observable sequence with an array collecting the last elements of all the input sequences.</returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- [Experimental]
- public static IQbservable<TSource[]> ForkJoin<TSource>(this IQbservableProvider provider, params IObservable<TSource>[] sources)
- {
- if (provider == null)
- throw new ArgumentNullException(nameof(provider));
- if (sources == null)
- throw new ArgumentNullException(nameof(sources));
-
- return provider.CreateQuery<TSource[]>(
- Expression.Call(
- null,
- #if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.ForkJoin<TSource>(default(IQbservableProvider), default(IObservable<TSource>[]))),
- #else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
- #endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
- #endif
-
- #if !STABLE
- /// <summary>
- /// Runs all observable sequences in the enumerable sources sequence in parallel and collect their last elements.
- /// </summary>
- /// <param name="provider">Query provider used to construct the <see cref="IQbservable{T}"/> data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequence to collect the last elements for.</param>
- /// <returns>An observable sequence with an array collecting the last elements of all the input sequences.</returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- [Experimental]
- public static IQbservable<TSource[]> ForkJoin<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources)
- {
- if (provider == null)
- throw new ArgumentNullException(nameof(provider));
- if (sources == null)
- throw new ArgumentNullException(nameof(sources));
-
- return provider.CreateQuery<TSource[]>(
- Expression.Call(
- null,
- #if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.ForkJoin<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>))),
- #else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
- #endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
- #endif
-
- #if !STABLE
- /// <summary>
- /// Runs two observable sequences in parallel and combines their last elemenets.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="first">First observable sequence.</param>
- /// <param name="second">Second observable sequence.</param>
- /// <param name="resultSelector">Result selector function to invoke with the last elements of both sequences.</param>
- /// <returns>An observable sequence with the result of calling the selector function with the last elements of both input sequences.</returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="first" /> or <paramref name="second" /> or <paramref name="resultSelector" /> is null.</exception>
- [Experimental]
- public static IQbservable<TResult> ForkJoin<TSource1, TSource2, TResult>(this IQbservable<TSource1> first, IObservable<TSource2> second, Expression<Func<TSource1, TSource2, TResult>> resultSelector)
- {
- if (first == null)
- throw new ArgumentNullException(nameof(first));
- if (second == null)
- throw new ArgumentNullException(nameof(second));
- if (resultSelector == null)
- throw new ArgumentNullException(nameof(resultSelector));
-
- return first.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
- #if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.ForkJoin<TSource1, TSource2, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(Expression<Func<TSource1, TSource2, TResult>>))),
- #else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TResult)),
- #endif
- first.Expression,
- GetSourceExpression(second),
- resultSelector
- )
- );
- }
- #endif
-
- #if !STABLE
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.
- /// This operator allows for a fluent style of writing queries that use the same sequence multiple times.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence that will be shared in the selector function.</param>
- /// <param name="selector">Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- [Experimental]
- public static IQbservable<TResult> Let<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
- #if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.Let<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>))),
- #else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
- #endif
- source.Expression,
- selector
- )
- );
- }
- #endif
-
- #if !STABLE
- /// <summary>
- /// Comonadic bind operator.
- /// </summary>
- [Experimental]
- public static IQbservable<TResult> ManySelect<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, TResult>> selector)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
- #if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.ManySelect<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, TResult>>))),
- #else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
- #endif
- source.Expression,
- selector
- )
- );
- }
- #endif
-
- #if !STABLE
- /// <summary>
- /// Comonadic bind operator.
- /// </summary>
- [Experimental]
- public static IQbservable<TResult> ManySelect<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, TResult>> selector, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- if (scheduler == null)
- throw new ArgumentNullException(nameof(scheduler));
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
- #if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.ManySelect<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, TResult>>), default(IScheduler))),
- #else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
- #endif
- source.Expression,
- selector,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
- #endif
-
- }
- }
- #pragma warning restore 1591
|