QbservableEx.Generated.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. /*
  2. * WARNING: Auto-generated file (5/1/2015 21:21:20)
  3. * Run Rx's auto-homoiconizer tool to generate this file (in the HomoIcon directory).
  4. */
  5. #pragma warning disable 1591
  6. using System;
  7. using System.Reactive.Concurrency;
  8. using System.Collections.Generic;
  9. using System.Reactive.Joins;
  10. using System.Linq;
  11. using System.Linq.Expressions;
  12. using System.Reflection;
  13. using System.Threading;
  14. using System.Threading.Tasks;
  15. using System.Reactive;
  16. using System.Reactive.Subjects;
  17. namespace System.Reactive.Linq
  18. {
  19. public static partial class QbservableEx
  20. {
  21. #if !STABLE
  22. /// <summary>
  23. /// 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.
  24. /// </summary>
  25. /// <param name="provider">Query provider used to construct the <see cref="IQbservable{T}"/> data source.</param>
  26. /// <param name="iteratorMethod">Iterator method that drives the resulting observable sequence.</param>
  27. /// <returns>An observable sequence obtained by running the iterator and returning Unit values for each iteration step.</returns>
  28. /// <exception cref="ArgumentNullException">
  29. /// <paramref name="iteratorMethod" /> is null.</exception>
  30. [Experimental]
  31. public static IQbservable<Unit> Create(this IQbservableProvider provider, Expression<Func<IEnumerable<IObservable<object>>>> iteratorMethod)
  32. {
  33. if (provider == null)
  34. throw new ArgumentNullException(nameof(provider));
  35. if (iteratorMethod == null)
  36. throw new ArgumentNullException(nameof(iteratorMethod));
  37. return provider.CreateQuery<Unit>(
  38. Expression.Call(
  39. null,
  40. #if CRIPPLED_REFLECTION
  41. InfoOf(() => QbservableEx.Create(default(IQbservableProvider), default(Expression<Func<IEnumerable<IObservable<object>>>>))),
  42. #else
  43. (MethodInfo)MethodInfo.GetCurrentMethod(),
  44. #endif
  45. Expression.Constant(provider, typeof(IQbservableProvider)),
  46. iteratorMethod
  47. )
  48. );
  49. }
  50. #endif
  51. #if !STABLE
  52. /// <summary>
  53. /// 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.
  54. /// </summary>
  55. /// <param name="provider">Query provider used to construct the <see cref="IQbservable{T}"/> data source.</param>
  56. /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
  57. /// <param name="iteratorMethod">Iterator method that produces elements in the resulting sequence by calling the given observer.</param>
  58. /// <returns>An observable sequence obtained by running the iterator and returning the elements that were sent to the observer.</returns>
  59. /// <exception cref="ArgumentNullException">
  60. /// <paramref name="iteratorMethod" /> is null.</exception>
  61. [Experimental]
  62. public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, IEnumerable<IObservable<object>>>> iteratorMethod)
  63. {
  64. if (provider == null)
  65. throw new ArgumentNullException(nameof(provider));
  66. if (iteratorMethod == null)
  67. throw new ArgumentNullException(nameof(iteratorMethod));
  68. return provider.CreateQuery<TResult>(
  69. Expression.Call(
  70. null,
  71. #if CRIPPLED_REFLECTION
  72. InfoOf(() => QbservableEx.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, IEnumerable<IObservable<object>>>>))),
  73. #else
  74. ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
  75. #endif
  76. Expression.Constant(provider, typeof(IQbservableProvider)),
  77. iteratorMethod
  78. )
  79. );
  80. }
  81. #endif
  82. #if !STABLE
  83. /// <summary>
  84. /// Expands an observable sequence by recursively invoking selector.
  85. /// </summary>
  86. /// <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>
  87. /// <param name="source">Source sequence with the initial elements.</param>
  88. /// <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>
  89. /// <returns>An observable sequence containing all the elements produced by the recursive expansion.</returns>
  90. /// <exception cref="ArgumentNullException">
  91. /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
  92. [Experimental]
  93. public static IQbservable<TSource> Expand<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TSource>>> selector)
  94. {
  95. if (source == null)
  96. throw new ArgumentNullException(nameof(source));
  97. if (selector == null)
  98. throw new ArgumentNullException(nameof(selector));
  99. return source.Provider.CreateQuery<TSource>(
  100. Expression.Call(
  101. null,
  102. #if CRIPPLED_REFLECTION
  103. InfoOf(() => QbservableEx.Expand<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TSource>>>))),
  104. #else
  105. ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
  106. #endif
  107. source.Expression,
  108. selector
  109. )
  110. );
  111. }
  112. #endif
  113. #if !STABLE
  114. /// <summary>
  115. /// Expands an observable sequence by recursively invoking selector, using the specified scheduler to enumerate the queue of obtained sequences.
  116. /// </summary>
  117. /// <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>
  118. /// <param name="source">Source sequence with the initial elements.</param>
  119. /// <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>
  120. /// <param name="scheduler">Scheduler on which to perform the expansion by enumerating the internal queue of obtained sequences.</param>
  121. /// <returns>An observable sequence containing all the elements produced by the recursive expansion.</returns>
  122. /// <exception cref="ArgumentNullException">
  123. /// <paramref name="source" /> or <paramref name="selector" /> or <paramref name="scheduler" /> is null.</exception>
  124. [Experimental]
  125. public static IQbservable<TSource> Expand<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TSource>>> selector, IScheduler scheduler)
  126. {
  127. if (source == null)
  128. throw new ArgumentNullException(nameof(source));
  129. if (selector == null)
  130. throw new ArgumentNullException(nameof(selector));
  131. if (scheduler == null)
  132. throw new ArgumentNullException(nameof(scheduler));
  133. return source.Provider.CreateQuery<TSource>(
  134. Expression.Call(
  135. null,
  136. #if CRIPPLED_REFLECTION
  137. InfoOf(() => QbservableEx.Expand<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TSource>>>), default(IScheduler))),
  138. #else
  139. ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
  140. #endif
  141. source.Expression,
  142. selector,
  143. Expression.Constant(scheduler, typeof(IScheduler))
  144. )
  145. );
  146. }
  147. #endif
  148. #if !STABLE
  149. /// <summary>
  150. /// Runs all specified observable sequences in parallel and collects their last elements.
  151. /// </summary>
  152. /// <param name="provider">Query provider used to construct the <see cref="IQbservable{T}"/> data source.</param>
  153. /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
  154. /// <param name="sources">Observable sequence to collect the last elements for.</param>
  155. /// <returns>An observable sequence with an array collecting the last elements of all the input sequences.</returns>
  156. /// <exception cref="ArgumentNullException">
  157. /// <paramref name="sources" /> is null.</exception>
  158. [Experimental]
  159. public static IQbservable<TSource[]> ForkJoin<TSource>(this IQbservableProvider provider, params IObservable<TSource>[] sources)
  160. {
  161. if (provider == null)
  162. throw new ArgumentNullException(nameof(provider));
  163. if (sources == null)
  164. throw new ArgumentNullException(nameof(sources));
  165. return provider.CreateQuery<TSource[]>(
  166. Expression.Call(
  167. null,
  168. #if CRIPPLED_REFLECTION
  169. InfoOf(() => QbservableEx.ForkJoin<TSource>(default(IQbservableProvider), default(IObservable<TSource>[]))),
  170. #else
  171. ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
  172. #endif
  173. Expression.Constant(provider, typeof(IQbservableProvider)),
  174. GetSourceExpression(sources)
  175. )
  176. );
  177. }
  178. #endif
  179. #if !STABLE
  180. /// <summary>
  181. /// Runs all observable sequences in the enumerable sources sequence in parallel and collect their last elements.
  182. /// </summary>
  183. /// <param name="provider">Query provider used to construct the <see cref="IQbservable{T}"/> data source.</param>
  184. /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
  185. /// <param name="sources">Observable sequence to collect the last elements for.</param>
  186. /// <returns>An observable sequence with an array collecting the last elements of all the input sequences.</returns>
  187. /// <exception cref="ArgumentNullException">
  188. /// <paramref name="sources" /> is null.</exception>
  189. [Experimental]
  190. public static IQbservable<TSource[]> ForkJoin<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources)
  191. {
  192. if (provider == null)
  193. throw new ArgumentNullException(nameof(provider));
  194. if (sources == null)
  195. throw new ArgumentNullException(nameof(sources));
  196. return provider.CreateQuery<TSource[]>(
  197. Expression.Call(
  198. null,
  199. #if CRIPPLED_REFLECTION
  200. InfoOf(() => QbservableEx.ForkJoin<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>))),
  201. #else
  202. ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
  203. #endif
  204. Expression.Constant(provider, typeof(IQbservableProvider)),
  205. GetSourceExpression(sources)
  206. )
  207. );
  208. }
  209. #endif
  210. #if !STABLE
  211. /// <summary>
  212. /// Runs two observable sequences in parallel and combines their last elemenets.
  213. /// </summary>
  214. /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
  215. /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
  216. /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
  217. /// <param name="first">First observable sequence.</param>
  218. /// <param name="second">Second observable sequence.</param>
  219. /// <param name="resultSelector">Result selector function to invoke with the last elements of both sequences.</param>
  220. /// <returns>An observable sequence with the result of calling the selector function with the last elements of both input sequences.</returns>
  221. /// <exception cref="ArgumentNullException">
  222. /// <paramref name="first" /> or <paramref name="second" /> or <paramref name="resultSelector" /> is null.</exception>
  223. [Experimental]
  224. public static IQbservable<TResult> ForkJoin<TSource1, TSource2, TResult>(this IQbservable<TSource1> first, IObservable<TSource2> second, Expression<Func<TSource1, TSource2, TResult>> resultSelector)
  225. {
  226. if (first == null)
  227. throw new ArgumentNullException(nameof(first));
  228. if (second == null)
  229. throw new ArgumentNullException(nameof(second));
  230. if (resultSelector == null)
  231. throw new ArgumentNullException(nameof(resultSelector));
  232. return first.Provider.CreateQuery<TResult>(
  233. Expression.Call(
  234. null,
  235. #if CRIPPLED_REFLECTION
  236. InfoOf(() => QbservableEx.ForkJoin<TSource1, TSource2, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(Expression<Func<TSource1, TSource2, TResult>>))),
  237. #else
  238. ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TResult)),
  239. #endif
  240. first.Expression,
  241. GetSourceExpression(second),
  242. resultSelector
  243. )
  244. );
  245. }
  246. #endif
  247. #if !STABLE
  248. /// <summary>
  249. /// Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.
  250. /// This operator allows for a fluent style of writing queries that use the same sequence multiple times.
  251. /// </summary>
  252. /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
  253. /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
  254. /// <param name="source">Source sequence that will be shared in the selector function.</param>
  255. /// <param name="selector">Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.</param>
  256. /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
  257. /// <exception cref="ArgumentNullException">
  258. /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
  259. [Experimental]
  260. public static IQbservable<TResult> Let<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector)
  261. {
  262. if (source == null)
  263. throw new ArgumentNullException(nameof(source));
  264. if (selector == null)
  265. throw new ArgumentNullException(nameof(selector));
  266. return source.Provider.CreateQuery<TResult>(
  267. Expression.Call(
  268. null,
  269. #if CRIPPLED_REFLECTION
  270. InfoOf(() => QbservableEx.Let<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>))),
  271. #else
  272. ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
  273. #endif
  274. source.Expression,
  275. selector
  276. )
  277. );
  278. }
  279. #endif
  280. #if !STABLE
  281. /// <summary>
  282. /// Comonadic bind operator.
  283. /// </summary>
  284. [Experimental]
  285. public static IQbservable<TResult> ManySelect<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, TResult>> selector)
  286. {
  287. if (source == null)
  288. throw new ArgumentNullException(nameof(source));
  289. if (selector == null)
  290. throw new ArgumentNullException(nameof(selector));
  291. return source.Provider.CreateQuery<TResult>(
  292. Expression.Call(
  293. null,
  294. #if CRIPPLED_REFLECTION
  295. InfoOf(() => QbservableEx.ManySelect<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, TResult>>))),
  296. #else
  297. ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
  298. #endif
  299. source.Expression,
  300. selector
  301. )
  302. );
  303. }
  304. #endif
  305. #if !STABLE
  306. /// <summary>
  307. /// Comonadic bind operator.
  308. /// </summary>
  309. [Experimental]
  310. public static IQbservable<TResult> ManySelect<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, TResult>> selector, IScheduler scheduler)
  311. {
  312. if (source == null)
  313. throw new ArgumentNullException(nameof(source));
  314. if (selector == null)
  315. throw new ArgumentNullException(nameof(selector));
  316. if (scheduler == null)
  317. throw new ArgumentNullException(nameof(scheduler));
  318. return source.Provider.CreateQuery<TResult>(
  319. Expression.Call(
  320. null,
  321. #if CRIPPLED_REFLECTION
  322. InfoOf(() => QbservableEx.ManySelect<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, TResult>>), default(IScheduler))),
  323. #else
  324. ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
  325. #endif
  326. source.Expression,
  327. selector,
  328. Expression.Constant(scheduler, typeof(IScheduler))
  329. )
  330. );
  331. }
  332. #endif
  333. }
  334. }
  335. #pragma warning restore 1591