1
0

QbservableEx.Generated.cs 18 KB

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