[PLinq] Tidy up file hierarchy in System.Linq
[mono.git] / mcs / class / System.Core / System.Linq.Parallel / QueryOptions.cs
1 #if NET_4_0
2 //
3 // QueryOptions.cs
4 //
5 // Author:
6 //       Jérémie "Garuma" Laval <jeremie.laval@gmail.com>
7 //
8 // Copyright (c) 2010 Jérémie "Garuma" Laval
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining a copy
11 // of this software and associated documentation files (the "Software"), to deal
12 // in the Software without restriction, including without limitation the rights
13 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 // copies of the Software, and to permit persons to whom the Software is
15 // furnished to do so, subject to the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be included in
18 // all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 // THE SOFTWARE.
27
28 using System;
29 using System.Threading;
30
31 namespace System.Linq
32 {
33         internal class QueryOptions
34         {
35                 public ParallelMergeOptions? Options;
36                 public ParallelExecutionMode? Mode;
37                 public CancellationToken Token;
38                 /* This token is to be used by some operator (like Take) to tell that
39                  * the execution of the query can be prematurly stopped
40                  *
41                  * It is set when passing QueryOptions to the different node's Get method
42                  * and ParallelExecuter should check after the call to this method is this guy has been
43                  * set. Operator may chain up multiple cancellation token that way.
44                  * When checking for this token, the task body should simply return.
45                  */
46                 public CancellationToken ImplementerToken;
47                 public bool UseStrip;
48                 public bool? BehindOrderGuard;
49                 public int PartitionCount;
50                 public Tuple<bool, bool, bool> PartitionerSettings;
51
52                 public QueryOptions (ParallelMergeOptions? options,
53                                      ParallelExecutionMode? mode,
54                                      CancellationToken token,
55                                      bool useStrip,
56                                      bool? behindOrderGuard,
57                                      int partitionCount,
58                                      CancellationToken implementerToken)
59                 {
60                         Options = options;
61                         Mode = mode;
62                         Token = token;
63                         UseStrip = useStrip;
64                         BehindOrderGuard = behindOrderGuard;
65                         PartitionCount = partitionCount;
66                         PartitionerSettings = null;
67                         ImplementerToken = implementerToken;
68                 }
69         }
70 }
71 #endif