QbservableEx.Generated.cs 18 KB

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