1 //
2 // Copyright (c) ZeroC, Inc. All rights reserved.
3 //
4 
5 using System;
6 using System.Collections.Generic;
7 using System.Threading;
8 using System.Threading.Tasks;
9 
10 namespace Ice
11 {
12     namespace operations
13     {
14         namespace AMD
15         {
16             namespace tie
17             {
18                 public sealed class MyDerivedClassI : Test.MyDerivedClassTie_
19                 {
MyDerivedClassI()20                     public MyDerivedClassI() : base(new MyDerivedClassTieI())
21                     {
22                     }
23                 }
24 
25                 public sealed class MyDerivedClassTieI : Test.MyDerivedClassOperations_
26                 {
test(bool b)27                     private static void test(bool b)
28                     {
29                         if (!b)
30                         {
31                             throw new System.Exception();
32                         }
33                     }
34 
35                     internal class Thread_opVoid : TaskCompletionSource<object>
36                     {
Thread_opVoid()37                         public Thread_opVoid()
38                         {
39                         }
40 
Start()41                         public void Start()
42                         {
43                             lock (this)
44                             {
45                                 _thread = new Thread(new ThreadStart(Run));
46                                 _thread.Start();
47                             }
48                         }
49 
Run()50                         public void Run()
51                         {
52                             SetResult(null);
53                         }
54 
Join()55                         public void Join()
56                         {
57                             lock (this)
58                             {
59                                 _thread.Join();
60                             }
61                         }
62 
63                         private Thread _thread;
64                     }
65 
shutdownAsync(Ice.Current current)66                     public Task shutdownAsync(Ice.Current current)
67                     {
68                         while (_opVoidThread != null)
69                         {
70                             _opVoidThread.Join();
71                             _opVoidThread = null;
72                         }
73 
74                         current.adapter.getCommunicator().shutdown();
75                         return null;
76                     }
77 
supportsCompressAsync(Ice.Current current)78                     public Task<bool> supportsCompressAsync(Ice.Current current)
79                     {
80                         return Task.FromResult(true);
81                     }
82 
opVoidAsync(Ice.Current current)83                     public Task opVoidAsync(Ice.Current current)
84                     {
85                         test(current.mode == Ice.OperationMode.Normal);
86 
87                         while (_opVoidThread != null)
88                         {
89                             _opVoidThread.Join();
90                             _opVoidThread = null;
91                         }
92 
93                         _opVoidThread = new Thread_opVoid();
94                         _opVoidThread.Start();
95                         return _opVoidThread.Task;
96                     }
97 
opBoolAsync(bool p1, bool p2, Ice.Current current)98                     public Task<Test.MyClass_OpBoolResult> opBoolAsync(bool p1, bool p2, Ice.Current current)
99                     {
100                         return Task.FromResult(new Test.MyClass_OpBoolResult(p2, p1));
101                     }
102 
opBoolSAsync(bool[] p1, bool[] p2, Ice.Current current)103                     public Task<Test.MyClass_OpBoolSResult> opBoolSAsync(bool[] p1, bool[] p2, Ice.Current current)
104                     {
105                         bool[] p3 = new bool[p1.Length + p2.Length];
106                         Array.Copy(p1, p3, p1.Length);
107                         Array.Copy(p2, 0, p3, p1.Length, p2.Length);
108 
109                         bool[] r = new bool[p1.Length];
110                         for (int i = 0; i < p1.Length; i++)
111                         {
112                             r[i] = p1[p1.Length - (i + 1)];
113                         }
114 
115                         return Task.FromResult(new Test.MyClass_OpBoolSResult(r, p3));
116                     }
117 
118                     public Task<Test.MyClass_OpBoolSSResult>
opBoolSSAsync(bool[][] p1, bool[][] p2, Ice.Current current)119                     opBoolSSAsync(bool[][] p1, bool[][] p2, Ice.Current current)
120                     {
121                         bool[][] p3 = new bool[p1.Length + p2.Length][];
122                         Array.Copy(p1, p3, p1.Length);
123                         Array.Copy(p2, 0, p3, p1.Length, p2.Length);
124 
125                         bool[][] r = new bool[p1.Length][];
126                         for (int i = 0; i < p1.Length; i++)
127                         {
128                             r[i] = p1[p1.Length - (i + 1)];
129                         }
130 
131                         return Task.FromResult(new Test.MyClass_OpBoolSSResult(r, p3));
132                     }
133 
134                     public Task<Test.MyClass_OpByteResult>
opByteAsync(byte p1, byte p2, Ice.Current current)135                     opByteAsync(byte p1, byte p2, Ice.Current current)
136                     {
137                         return Task.FromResult(new Test.MyClass_OpByteResult(p1, (byte)(p1 ^ p2)));
138                     }
139 
140                     public Task<Test.MyClass_OpByteBoolDResult>
opByteBoolDAsync(Dictionary<byte, bool> p1, Dictionary<byte, bool> p2, Ice.Current current)141                     opByteBoolDAsync(Dictionary<byte, bool> p1, Dictionary<byte, bool> p2, Ice.Current current)
142                     {
143                         Dictionary<byte, bool> p3 = p1;
144                         Dictionary<byte, bool> r = new Dictionary<byte, bool>();
145                         foreach (KeyValuePair<byte, bool> e in p1)
146                         {
147                             r[e.Key] = e.Value;
148                         }
149                         foreach (KeyValuePair<byte, bool> e in p2)
150                         {
151                             r[e.Key] = e.Value;
152                         }
153 
154                         return Task.FromResult(new Test.MyClass_OpByteBoolDResult(r, p3));
155                     }
156 
157                     public Task<Test.MyClass_OpByteSResult>
opByteSAsync(byte[] p1, byte[] p2, Ice.Current current)158                     opByteSAsync(byte[] p1, byte[] p2, Ice.Current current)
159                     {
160                         byte[] p3 = new byte[p1.Length];
161                         for (int i = 0; i < p1.Length; i++)
162                         {
163                             p3[i] = p1[p1.Length - (i + 1)];
164                         }
165 
166                         byte[] r = new byte[p1.Length + p2.Length];
167                         Array.Copy(p1, r, p1.Length);
168                         Array.Copy(p2, 0, r, p1.Length, p2.Length);
169 
170                         return Task.FromResult(new Test.MyClass_OpByteSResult(r, p3));
171                     }
172 
173                     public Task<Test.MyClass_OpByteSSResult>
opByteSSAsync(byte[][] p1, byte[][] p2, Ice.Current current)174                     opByteSSAsync(byte[][] p1, byte[][] p2, Ice.Current current)
175                     {
176                         byte[][] p3 = new byte[p1.Length][];
177                         for (int i = 0; i < p1.Length; i++)
178                         {
179                             p3[i] = p1[p1.Length - (i + 1)];
180                         }
181 
182                         byte[][] r = new byte[p1.Length + p2.Length][];
183                         Array.Copy(p1, r, p1.Length);
184                         Array.Copy(p2, 0, r, p1.Length, p2.Length);
185 
186                         return Task.FromResult(new Test.MyClass_OpByteSSResult(r, p3));
187                     }
188 
189                     public Task<Test.MyClass_OpFloatDoubleResult>
opFloatDoubleAsync(float p1, double p2, Ice.Current current)190                     opFloatDoubleAsync(float p1, double p2, Ice.Current current)
191                     {
192                         return Task.FromResult(new Test.MyClass_OpFloatDoubleResult(p2, p1, p2));
193                     }
194 
195                     public Task<Test.MyClass_OpFloatDoubleSResult>
opFloatDoubleSAsync(float[] p1, double[] p2, Ice.Current current)196                     opFloatDoubleSAsync(float[] p1, double[] p2, Ice.Current current)
197                     {
198                         float[] p3 = p1;
199 
200                         double[] p4 = new double[p2.Length];
201                         for (int i = 0; i < p2.Length; i++)
202                         {
203                             p4[i] = p2[p2.Length - (i + 1)];
204                         }
205 
206                         double[] r = new double[p2.Length + p1.Length];
207                         Array.Copy(p2, r, p2.Length);
208                         for (int i = 0; i < p1.Length; i++)
209                         {
210                             r[p2.Length + i] = p1[i];
211                         }
212 
213                         return Task.FromResult(new Test.MyClass_OpFloatDoubleSResult(r, p3, p4));
214                     }
215 
216                     public Task<Test.MyClass_OpFloatDoubleSSResult>
opFloatDoubleSSAsync(float[][] p1, double[][] p2, Ice.Current current)217                     opFloatDoubleSSAsync(float[][] p1, double[][] p2, Ice.Current current)
218                     {
219                         var p3 = p1;
220 
221                         var p4 = new double[p2.Length][];
222                         for (int i = 0; i < p2.Length; i++)
223                         {
224                             p4[i] = p2[p2.Length - (i + 1)];
225                         }
226 
227                         var r = new double[p2.Length + p2.Length][];
228                         Array.Copy(p2, r, p2.Length);
229                         for (int i = 0; i < p2.Length; i++)
230                         {
231                             r[p2.Length + i] = new double[p2[i].Length];
232                             for (int j = 0; j < p2[i].Length; j++)
233                             {
234                                 r[p2.Length + i][j] = p2[i][j];
235                             }
236                         }
237 
238                         return Task.FromResult(new Test.MyClass_OpFloatDoubleSSResult(r, p3, p4));
239                     }
240 
241                     public Task<Test.MyClass_OpLongFloatDResult>
opLongFloatDAsync(Dictionary<long, float> p1, Dictionary<long, float> p2, Ice.Current current)242                     opLongFloatDAsync(Dictionary<long, float> p1, Dictionary<long, float> p2, Ice.Current current)
243                     {
244                         var p3 = p1;
245                         var r = new Dictionary<long, float>();
246                         foreach (KeyValuePair<long, float> e in p1)
247                         {
248                             r[e.Key] = e.Value;
249                         }
250                         foreach (KeyValuePair<long, float> e in p2)
251                         {
252                             r[e.Key] = e.Value;
253                         }
254 
255                         return Task.FromResult(new Test.MyClass_OpLongFloatDResult(r, p3));
256                     }
257 
258                     public Task<Test.MyClass_OpMyClassResult>
opMyClassAsync(Test.MyClassPrx p1, Ice.Current current)259                     opMyClassAsync(Test.MyClassPrx p1, Ice.Current current)
260                     {
261                         var p2 = p1;
262                         var p3 = Test.MyClassPrxHelper.uncheckedCast(current.adapter.createProxy(
263                                                                 Ice.Util.stringToIdentity("noSuchIdentity")));
264                         return Task.FromResult(new Test.MyClass_OpMyClassResult(
265                             Test.MyClassPrxHelper.uncheckedCast(current.adapter.createProxy(current.id)), p2, p3));
266                     }
267 
268                     public Task<Test.MyClass_OpMyEnumResult>
opMyEnumAsync(Test.MyEnum p1, Ice.Current current)269                     opMyEnumAsync(Test.MyEnum p1, Ice.Current current)
270                     {
271                         return Task.FromResult<Test.MyClass_OpMyEnumResult>(new Test.MyClass_OpMyEnumResult(Test.MyEnum.enum3, p1));
272                     }
273 
274                     public Task<Test.MyClass_OpShortIntDResult>
opShortIntDAsync(Dictionary<short, int> p1, Dictionary<short, int> p2, Ice.Current current)275                     opShortIntDAsync(Dictionary<short, int> p1, Dictionary<short, int> p2, Ice.Current current)
276                     {
277                         var p3 = p1;
278                         var r = new Dictionary<short, int>();
279                         foreach (KeyValuePair<short, int> e in p1)
280                         {
281                             r[e.Key] = e.Value;
282                         }
283                         foreach (KeyValuePair<short, int> e in p2)
284                         {
285                             r[e.Key] = e.Value;
286                         }
287                         return Task.FromResult(new Test.MyClass_OpShortIntDResult(r, p3));
288                     }
289 
290                     public Task<Test.MyClass_OpShortIntLongResult>
opShortIntLongAsync(short p1, int p2, long p3, Ice.Current current)291                     opShortIntLongAsync(short p1, int p2, long p3, Ice.Current current)
292                     {
293                         return Task.FromResult(new Test.MyClass_OpShortIntLongResult(p3, p1, p2, p3));
294                     }
295 
296                     public Task<Test.MyClass_OpShortIntLongSResult>
opShortIntLongSAsync(short[] p1, int[] p2, long[] p3, Ice.Current current)297                     opShortIntLongSAsync(short[] p1, int[] p2, long[] p3, Ice.Current current)
298                     {
299                         var p4 = p1;
300                         var p5 = new int[p2.Length];
301                         for (int i = 0; i < p2.Length; i++)
302                         {
303                             p5[i] = p2[p2.Length - (i + 1)];
304                         }
305                         var p6 = new long[p3.Length + p3.Length];
306                         Array.Copy(p3, p6, p3.Length);
307                         Array.Copy(p3, 0, p6, p3.Length, p3.Length);
308                         return Task.FromResult(new Test.MyClass_OpShortIntLongSResult(p3, p4, p5, p6));
309                     }
310 
311                     public Task<Test.MyClass_OpShortIntLongSSResult>
opShortIntLongSSAsync(short[][] p1, int[][] p2, long[][] p3, Ice.Current current)312                     opShortIntLongSSAsync(short[][] p1, int[][] p2, long[][] p3, Ice.Current current)
313                     {
314                         var p4 = p1;
315 
316                         var p5 = new int[p2.Length][];
317                         for (int i = 0; i < p2.Length; i++)
318                         {
319                             p5[i] = p2[p2.Length - (i + 1)];
320                         }
321 
322                         var p6 = new long[p3.Length + p3.Length][];
323                         Array.Copy(p3, p6, p3.Length);
324                         Array.Copy(p3, 0, p6, p3.Length, p3.Length);
325                         return Task.FromResult(new Test.MyClass_OpShortIntLongSSResult(p3, p4, p5, p6));
326                     }
327 
328                     public Task<Test.MyClass_OpStringResult>
opStringAsync(string p1, string p2, Ice.Current current)329                     opStringAsync(string p1, string p2, Ice.Current current)
330                     {
331                         return Task.FromResult(new Test.MyClass_OpStringResult(p1 + " " + p2, p2 + " " + p1));
332                     }
333 
334                     public Task<Test.MyClass_OpStringMyEnumDResult>
opStringMyEnumDAsync(Dictionary<string, Test.MyEnum> p1, Dictionary<string, Test.MyEnum> p2, Ice.Current current)335                     opStringMyEnumDAsync(Dictionary<string, Test.MyEnum> p1, Dictionary<string, Test.MyEnum> p2, Ice.Current current)
336                     {
337                         var p3 = p1;
338                         var r = new Dictionary<string, Test.MyEnum>();
339                         foreach (KeyValuePair<string, Test.MyEnum> e in p1)
340                         {
341                             r[e.Key] = e.Value;
342                         }
343                         foreach (KeyValuePair<string, Test.MyEnum> e in p2)
344                         {
345                             r[e.Key] = e.Value;
346                         }
347                         return Task.FromResult(new Test.MyClass_OpStringMyEnumDResult(r, p3));
348                     }
349 
350                     public Task<Test.MyClass_OpMyEnumStringDResult>
opMyEnumStringDAsync(Dictionary<Test.MyEnum, string> p1, Dictionary<Test.MyEnum, string> p2, Ice.Current current)351                     opMyEnumStringDAsync(Dictionary<Test.MyEnum, string> p1, Dictionary<Test.MyEnum, string> p2, Ice.Current current)
352                     {
353                         var p3 = p1;
354                         var r = new Dictionary<Test.MyEnum, string>();
355                         foreach (var e in p1)
356                         {
357                             r[e.Key] = e.Value;
358                         }
359                         foreach (KeyValuePair<Test.MyEnum, string> e in p2)
360                         {
361                             r[e.Key] = e.Value;
362                         }
363                         return Task.FromResult(new Test.MyClass_OpMyEnumStringDResult(r, p3));
364                     }
365 
366                     public Task<Test.MyClass_OpMyStructMyEnumDResult>
opMyStructMyEnumDAsync(Dictionary<Test.MyStruct, Test.MyEnum> p1, Dictionary<Test.MyStruct, Test.MyEnum> p2, Ice.Current current)367                     opMyStructMyEnumDAsync(Dictionary<Test.MyStruct, Test.MyEnum> p1,
368                                            Dictionary<Test.MyStruct, Test.MyEnum> p2, Ice.Current current)
369                     {
370                         var p3 = p1;
371                         var r = new Dictionary<Test.MyStruct, Test.MyEnum>();
372                         foreach (var e in p1)
373                         {
374                             r[e.Key] = e.Value;
375                         }
376                         foreach (var e in p2)
377                         {
378                             r[e.Key] = e.Value;
379                         }
380                         return Task.FromResult(new Test.MyClass_OpMyStructMyEnumDResult(r, p3));
381                     }
382 
383                     public Task<Test.MyClass_OpByteBoolDSResult>
opByteBoolDSAsync(Dictionary<byte, bool>[] p1, Dictionary<byte, bool>[] p2, Ice.Current current)384                     opByteBoolDSAsync(Dictionary<byte, bool>[] p1, Dictionary<byte, bool>[] p2, Ice.Current current)
385                     {
386                         var p3 = new Dictionary<byte, bool>[p1.Length + p2.Length];
387                         Array.Copy(p2, p3, p2.Length);
388                         Array.Copy(p1, 0, p3, p2.Length, p1.Length);
389 
390                         var r = new Dictionary<byte, bool>[p1.Length];
391                         for (int i = 0; i < p1.Length; i++)
392                         {
393                             r[i] = p1[p1.Length - (i + 1)];
394                         }
395                         return Task.FromResult(new Test.MyClass_OpByteBoolDSResult(r, p3));
396                     }
397 
398                     public Task<Test.MyClass_OpShortIntDSResult>
opShortIntDSAsync(Dictionary<short, int>[] p1, Dictionary<short, int>[] p2, Ice.Current current)399                     opShortIntDSAsync(Dictionary<short, int>[] p1, Dictionary<short, int>[] p2, Ice.Current current)
400                     {
401                         var p3 = new Dictionary<short, int>[p1.Length + p2.Length];
402                         Array.Copy(p2, p3, p2.Length);
403                         Array.Copy(p1, 0, p3, p2.Length, p1.Length);
404 
405                         var r = new Dictionary<short, int>[p1.Length];
406                         for (int i = 0; i < p1.Length; i++)
407                         {
408                             r[i] = p1[p1.Length - (i + 1)];
409                         }
410                         return Task.FromResult(new Test.MyClass_OpShortIntDSResult(r, p3));
411                     }
412 
413                     public Task<Test.MyClass_OpLongFloatDSResult>
opLongFloatDSAsync(Dictionary<long, float>[] p1, Dictionary<long, float>[] p2, Ice.Current current)414                     opLongFloatDSAsync(Dictionary<long, float>[] p1, Dictionary<long, float>[] p2, Ice.Current current)
415                     {
416                         var p3 = new Dictionary<long, float>[p1.Length + p2.Length];
417                         Array.Copy(p2, p3, p2.Length);
418                         Array.Copy(p1, 0, p3, p2.Length, p1.Length);
419 
420                         var r = new Dictionary<long, float>[p1.Length];
421                         for (int i = 0; i < p1.Length; i++)
422                         {
423                             r[i] = p1[p1.Length - (i + 1)];
424                         }
425                         return Task.FromResult(new Test.MyClass_OpLongFloatDSResult(r, p3));
426                     }
427 
428                     public Task<Test.MyClass_OpStringStringDSResult>
opStringStringDSAsync(Dictionary<string, string>[] p1, Dictionary<string, string>[] p2, Ice.Current current)429                     opStringStringDSAsync(Dictionary<string, string>[] p1, Dictionary<string, string>[] p2, Ice.Current current)
430                     {
431                         var p3 = new Dictionary<string, string>[p1.Length + p2.Length];
432                         Array.Copy(p2, p3, p2.Length);
433                         Array.Copy(p1, 0, p3, p2.Length, p1.Length);
434 
435                         var r = new Dictionary<string, string>[p1.Length];
436                         for (int i = 0; i < p1.Length; i++)
437                         {
438                             r[i] = p1[p1.Length - (i + 1)];
439                         }
440                         return Task.FromResult(new Test.MyClass_OpStringStringDSResult(r, p3));
441                     }
442 
443                     public Task<Test.MyClass_OpStringMyEnumDSResult>
opStringMyEnumDSAsync(Dictionary<string, Test.MyEnum>[] p1, Dictionary<string, Test.MyEnum>[] p2, Ice.Current current)444                     opStringMyEnumDSAsync(Dictionary<string, Test.MyEnum>[] p1, Dictionary<string, Test.MyEnum>[] p2, Ice.Current current)
445                     {
446                         var p3 = new Dictionary<string, Test.MyEnum>[p1.Length + p2.Length];
447                         Array.Copy(p2, p3, p2.Length);
448                         Array.Copy(p1, 0, p3, p2.Length, p1.Length);
449 
450                         var r = new Dictionary<string, Test.MyEnum>[p1.Length];
451                         for (int i = 0; i < p1.Length; i++)
452                         {
453                             r[i] = p1[p1.Length - (i + 1)];
454                         }
455                         return Task.FromResult(new Test.MyClass_OpStringMyEnumDSResult(r, p3));
456                     }
457 
458                     public Task<Test.MyClass_OpMyEnumStringDSResult>
opMyEnumStringDSAsync(Dictionary<Test.MyEnum, string>[] p1, Dictionary<Test.MyEnum, string>[] p2, Ice.Current current)459                     opMyEnumStringDSAsync(Dictionary<Test.MyEnum, string>[] p1, Dictionary<Test.MyEnum, string>[] p2, Ice.Current current)
460                     {
461                         var p3 = new Dictionary<Test.MyEnum, string>[p1.Length + p2.Length];
462                         Array.Copy(p2, p3, p2.Length);
463                         Array.Copy(p1, 0, p3, p2.Length, p1.Length);
464 
465                         var r = new Dictionary<Test.MyEnum, string>[p1.Length];
466                         for (int i = 0; i < p1.Length; i++)
467                         {
468                             r[i] = p1[p1.Length - (i + 1)];
469                         }
470                         return Task.FromResult(new Test.MyClass_OpMyEnumStringDSResult(r, p3));
471                     }
472 
473                     public Task<Test.MyClass_OpMyStructMyEnumDSResult>
opMyStructMyEnumDSAsync(Dictionary<Test.MyStruct, Test.MyEnum>[] p1, Dictionary<Test.MyStruct, Test.MyEnum>[] p2, Ice.Current current)474                     opMyStructMyEnumDSAsync(Dictionary<Test.MyStruct, Test.MyEnum>[] p1, Dictionary<Test.MyStruct, Test.MyEnum>[] p2,
475                         Ice.Current current)
476                     {
477                         var p3 = new Dictionary<Test.MyStruct, Test.MyEnum>[p1.Length + p2.Length];
478                         Array.Copy(p2, p3, p2.Length);
479                         Array.Copy(p1, 0, p3, p2.Length, p1.Length);
480 
481                         var r = new Dictionary<Test.MyStruct, Test.MyEnum>[p1.Length];
482                         for (int i = 0; i < p1.Length; i++)
483                         {
484                             r[i] = p1[p1.Length - (i + 1)];
485                         }
486                         return Task.FromResult(new Test.MyClass_OpMyStructMyEnumDSResult(r, p3));
487                     }
488 
489                     public Task<Test.MyClass_OpByteByteSDResult>
opByteByteSDAsync(Dictionary<byte, byte[]> p1, Dictionary<byte, byte[]> p2, Ice.Current current)490                     opByteByteSDAsync(Dictionary<byte, byte[]> p1, Dictionary<byte, byte[]> p2, Ice.Current current)
491                     {
492                         var p3 = p2;
493                         var r = new Dictionary<byte, byte[]>();
494                         foreach (var e in p1)
495                         {
496                             r[e.Key] = e.Value;
497                         }
498                         foreach (var e in p2)
499                         {
500                             r[e.Key] = e.Value;
501                         }
502                         return Task.FromResult(new Test.MyClass_OpByteByteSDResult(r, p3));
503                     }
504 
505                     public Task<Test.MyClass_OpBoolBoolSDResult>
opBoolBoolSDAsync(Dictionary<bool, bool[]> p1, Dictionary<bool, bool[]> p2, Ice.Current current)506                     opBoolBoolSDAsync(Dictionary<bool, bool[]> p1, Dictionary<bool, bool[]> p2, Ice.Current current)
507                     {
508                         var p3 = p2;
509                         var r = new Dictionary<bool, bool[]>();
510                         foreach (KeyValuePair<bool, bool[]> e in p1)
511                         {
512                             r[e.Key] = e.Value;
513                         }
514                         foreach (KeyValuePair<bool, bool[]> e in p2)
515                         {
516                             r[e.Key] = e.Value;
517                         }
518                         return Task.FromResult(new Test.MyClass_OpBoolBoolSDResult(r, p3));
519                     }
520 
521                     public Task<Test.MyClass_OpShortShortSDResult>
opShortShortSDAsync(Dictionary<short, short[]> p1, Dictionary<short, short[]> p2, Ice.Current current)522                     opShortShortSDAsync(Dictionary<short, short[]> p1, Dictionary<short, short[]> p2, Ice.Current current)
523                     {
524                         var p3 = p2;
525                         var r = new Dictionary<short, short[]>();
526                         foreach (var e in p1)
527                         {
528                             r[e.Key] = e.Value;
529                         }
530                         foreach (var e in p2)
531                         {
532                             r[e.Key] = e.Value;
533                         }
534                         return Task.FromResult(new Test.MyClass_OpShortShortSDResult(r, p3));
535                     }
536 
537                     public Task<Test.MyClass_OpIntIntSDResult>
opIntIntSDAsync(Dictionary<int, int[]> p1, Dictionary<int, int[]> p2, Ice.Current current)538                     opIntIntSDAsync(Dictionary<int, int[]> p1, Dictionary<int, int[]> p2, Ice.Current current)
539                     {
540                         var p3 = p2;
541                         var r = new Dictionary<int, int[]>();
542                         foreach (var e in p1)
543                         {
544                             r[e.Key] = e.Value;
545                         }
546                         foreach (var e in p2)
547                         {
548                             r[e.Key] = e.Value;
549                         }
550                         return Task.FromResult(new Test.MyClass_OpIntIntSDResult(r, p3));
551                     }
552 
553                     public Task<Test.MyClass_OpLongLongSDResult>
opLongLongSDAsync(Dictionary<long, long[]> p1, Dictionary<long, long[]> p2, Ice.Current current)554                     opLongLongSDAsync(Dictionary<long, long[]> p1, Dictionary<long, long[]> p2, Ice.Current current)
555                     {
556                         var p3 = p2;
557                         var r = new Dictionary<long, long[]>();
558                         foreach (var e in p1)
559                         {
560                             r[e.Key] = e.Value;
561                         }
562                         foreach (var e in p2)
563                         {
564                             r[e.Key] = e.Value;
565                         }
566                         return Task.FromResult(new Test.MyClass_OpLongLongSDResult(r, p3));
567                     }
568 
569                     public Task<Test.MyClass_OpStringFloatSDResult>
opStringFloatSDAsync(Dictionary<string, float[]> p1, Dictionary<string, float[]> p2, Ice.Current current)570                     opStringFloatSDAsync(Dictionary<string, float[]> p1, Dictionary<string, float[]> p2, Ice.Current current)
571                     {
572                         var p3 = p2;
573                         var r = new Dictionary<string, float[]>();
574                         foreach (var e in p1)
575                         {
576                             r[e.Key] = e.Value;
577                         }
578                         foreach (var e in p2)
579                         {
580                             r[e.Key] = e.Value;
581                         }
582                         return Task.FromResult(new Test.MyClass_OpStringFloatSDResult(r, p3));
583                     }
584 
585                     public Task<Test.MyClass_OpStringDoubleSDResult>
opStringDoubleSDAsync(Dictionary<string, double[]> p1, Dictionary<string, double[]> p2, Ice.Current current)586                     opStringDoubleSDAsync(Dictionary<string, double[]> p1, Dictionary<string, double[]> p2, Ice.Current current)
587                     {
588                         var p3 = p2;
589                         var r = new Dictionary<string, double[]>();
590                         foreach (var e in p1)
591                         {
592                             r[e.Key] = e.Value;
593                         }
594                         foreach (var e in p2)
595                         {
596                             r[e.Key] = e.Value;
597                         }
598                         return Task.FromResult(new Test.MyClass_OpStringDoubleSDResult(r, p3));
599                     }
600 
601                     public Task<Test.MyClass_OpStringStringSDResult>
opStringStringSDAsync(Dictionary<string, string[]> p1, Dictionary<string, string[]> p2, Ice.Current current)602                     opStringStringSDAsync(Dictionary<string, string[]> p1, Dictionary<string, string[]> p2, Ice.Current current)
603                     {
604                         var p3 = p2;
605                         var r = new Dictionary<string, string[]>();
606                         foreach (var e in p1)
607                         {
608                             r[e.Key] = e.Value;
609                         }
610                         foreach (var e in p2)
611                         {
612                             r[e.Key] = e.Value;
613                         }
614                         return Task.FromResult(new Test.MyClass_OpStringStringSDResult(r, p3));
615                     }
616 
617                     public Task<Test.MyClass_OpMyEnumMyEnumSDResult>
opMyEnumMyEnumSDAsync(Dictionary<Test.MyEnum, Test.MyEnum[]> p1, Dictionary<Test.MyEnum, Test.MyEnum[]> p2, Ice.Current current)618                     opMyEnumMyEnumSDAsync(Dictionary<Test.MyEnum, Test.MyEnum[]> p1,
619                                           Dictionary<Test.MyEnum, Test.MyEnum[]> p2, Ice.Current current)
620                     {
621                         var p3 = p2;
622                         var r = new Dictionary<Test.MyEnum, Test.MyEnum[]>();
623                         foreach (var e in p1)
624                         {
625                             r[e.Key] = e.Value;
626                         }
627                         foreach (var e in p2)
628                         {
629                             r[e.Key] = e.Value;
630                         }
631                         return Task.FromResult(new Test.MyClass_OpMyEnumMyEnumSDResult(r, p3));
632                     }
633 
634                     public Task<int[]>
opIntSAsync(int[] s, Ice.Current current)635                     opIntSAsync(int[] s, Ice.Current current)
636                     {
637                         var r = new int[s.Length];
638                         for (int i = 0; i < s.Length; ++i)
639                         {
640                             r[i] = -s[i];
641                         }
642                         return Task.FromResult(r);
643                     }
644 
645                     public Task<Dictionary<string, string>>
opContextAsync(Ice.Current current)646                     opContextAsync(Ice.Current current)
647                     {
648                         return Task.FromResult(current.ctx);
649                     }
650 
651                     public Task
opByteSOnewayAsync(byte[] s, Ice.Current current)652                     opByteSOnewayAsync(byte[] s, Ice.Current current)
653                     {
654                         lock (this)
655                         {
656                             ++_opByteSOnewayCallCount;
657                         }
658                         return null;
659                     }
660 
661                     public Task<int>
opByteSOnewayCallCountAsync(Ice.Current current)662                     opByteSOnewayCallCountAsync(Ice.Current current)
663                     {
664                         lock (this)
665                         {
666                             var count = _opByteSOnewayCallCount;
667                             _opByteSOnewayCallCount = 0;
668                             return Task.FromResult<int>(count);
669                         }
670                     }
671 
672                     public Task
opDoubleMarshalingAsync(double p1, double[] p2, Ice.Current current)673                     opDoubleMarshalingAsync(double p1, double[] p2, Ice.Current current)
674                     {
675                         var d = 1278312346.0 / 13.0;
676                         test(p1 == d);
677                         for (int i = 0; i < p2.Length; ++i)
678                         {
679                             test(p2[i] == d);
680                         }
681                         return null;
682                     }
683 
684                     public Task<Test.MyClass_OpStringSResult>
opStringSAsync(string[] p1, string[] p2, Ice.Current current)685                     opStringSAsync(string[] p1, string[] p2, Ice.Current current)
686                     {
687                         var p3 = new string[p1.Length + p2.Length];
688                         Array.Copy(p1, p3, p1.Length);
689                         Array.Copy(p2, 0, p3, p1.Length, p2.Length);
690 
691                         var r = new string[p1.Length];
692                         for (int i = 0; i < p1.Length; i++)
693                         {
694                             r[i] = p1[p1.Length - (i + 1)];
695                         }
696                         return Task.FromResult(new Test.MyClass_OpStringSResult(r, p3));
697                     }
698 
699                     public Task<Test.MyClass_OpStringSSResult>
opStringSSAsync(string[][] p1, string[][] p2, Ice.Current current)700                     opStringSSAsync(string[][] p1, string[][] p2, Ice.Current current)
701                     {
702                         var p3 = new string[p1.Length + p2.Length][];
703                         Array.Copy(p1, p3, p1.Length);
704                         Array.Copy(p2, 0, p3, p1.Length, p2.Length);
705                         var r = new string[p2.Length][];
706                         for (int i = 0; i < p2.Length; i++)
707                         {
708                             r[i] = p2[p2.Length - (i + 1)];
709                         }
710                         return Task.FromResult(new Test.MyClass_OpStringSSResult(r, p3));
711                     }
712 
713                     public Task<Test.MyClass_OpStringSSSResult>
opStringSSSAsync(string[][][] p1, string[][][] p2, Ice.Current current)714                     opStringSSSAsync(string[][][] p1, string[][][] p2, Ice.Current current)
715                     {
716                         var p3 = new string[p1.Length + p2.Length][][];
717                         Array.Copy(p1, p3, p1.Length);
718                         Array.Copy(p2, 0, p3, p1.Length, p2.Length);
719 
720                         var r = new string[p2.Length][][];
721                         for (int i = 0; i < p2.Length; i++)
722                         {
723                             r[i] = p2[p2.Length - (i + 1)];
724                         }
725                         return Task.FromResult(new Test.MyClass_OpStringSSSResult(r, p3));
726                     }
727 
728                     public Task<Test.MyClass_OpStringStringDResult>
opStringStringDAsync(Dictionary<string, string> p1, Dictionary<string, string> p2, Ice.Current current)729                     opStringStringDAsync(Dictionary<string, string> p1, Dictionary<string, string> p2, Ice.Current current)
730                     {
731                         var p3 = p1;
732                         var r = new Dictionary<string, string>();
733                         foreach (var e in p1)
734                         {
735                             r[e.Key] = e.Value;
736                         }
737                         foreach (var e in p2)
738                         {
739                             r[e.Key] = e.Value;
740                         }
741                         return Task.FromResult(new Test.MyClass_OpStringStringDResult(r, p3));
742                     }
743 
744                     public Task<Test.MyClass_OpStructResult>
opStructAsync(Test.Structure p1, Test.Structure p2, Ice.Current current)745                     opStructAsync(Test.Structure p1, Test.Structure p2, Ice.Current current)
746                     {
747                         var p3 = p1;
748                         p3.s.s = "a new string";
749                         return Task.FromResult(new Test.MyClass_OpStructResult(p2, p3));
750                     }
751 
752                     public Task
opIdempotentAsync(Ice.Current current)753                     opIdempotentAsync(Ice.Current current)
754                     {
755                         test(current.mode == Ice.OperationMode.Idempotent);
756                         return null;
757                     }
758 
759                     public Task
opNonmutatingAsync(Ice.Current current)760                     opNonmutatingAsync(Ice.Current current)
761                     {
762                         test(current.mode == Ice.OperationMode.Nonmutating);
763                         return null;
764                     }
765 
766                     public Task
opDerivedAsync(Ice.Current current)767                     opDerivedAsync(Ice.Current current)
768                     {
769                         return null;
770                     }
771 
772                     public Task<byte>
opByte1Async(byte value, Ice.Current current)773                     opByte1Async(byte value, Ice.Current current)
774                     {
775                         return Task.FromResult(value);
776                     }
777 
778                     public Task<short>
opShort1Async(short value, Ice.Current current)779                     opShort1Async(short value, Ice.Current current)
780                     {
781                         return Task.FromResult(value);
782                     }
783 
784                     public Task<int>
opInt1Async(int value, Ice.Current current)785                     opInt1Async(int value, Ice.Current current)
786                     {
787                         return Task.FromResult(value);
788                     }
789 
790                     public Task<long>
opLong1Async(long value, Ice.Current current)791                     opLong1Async(long value, Ice.Current current)
792                     {
793                         return Task.FromResult<long>(value);
794                     }
795 
796                     public Task<float>
opFloat1Async(float value, Ice.Current current)797                     opFloat1Async(float value, Ice.Current current)
798                     {
799                         return Task.FromResult(value);
800                     }
801 
802                     public Task<double>
opDouble1Async(double value, Ice.Current current)803                     opDouble1Async(double value, Ice.Current current)
804                     {
805                         return Task.FromResult(value);
806                     }
807 
808                     public Task<string>
opString1Async(string value, Ice.Current current)809                     opString1Async(string value, Ice.Current current)
810                     {
811                         return Task.FromResult(value);
812                     }
813 
814                     public Task<string[]>
opStringS1Async(string[] value, Ice.Current current)815                     opStringS1Async(string[] value, Ice.Current current)
816                     {
817                         return Task.FromResult(value);
818                     }
819 
820                     public Task<Dictionary<byte, bool>>
opByteBoolD1Async(Dictionary<byte, bool> value, Ice.Current current)821                     opByteBoolD1Async(Dictionary<byte, bool> value, Ice.Current current)
822                     {
823                         return Task.FromResult(value);
824                     }
825 
826                     public Task<string[]>
opStringS2Async(string[] value, Ice.Current current)827                     opStringS2Async(string[] value, Ice.Current current)
828                     {
829                         return Task.FromResult(value);
830                     }
831 
832                     public Task<Dictionary<byte, bool>>
opByteBoolD2Async(Dictionary<byte, bool> value, Ice.Current current)833                     opByteBoolD2Async(Dictionary<byte, bool> value, Ice.Current current)
834                     {
835                         return Task.FromResult(value);
836                     }
837 
838                     public Task<Test.MyClass1>
opMyClass1Async(Test.MyClass1 value, Ice.Current current)839                     opMyClass1Async(Test.MyClass1 value, Ice.Current current)
840                     {
841                         return Task.FromResult(value);
842                     }
843 
844                     public Task<Test.MyStruct1>
opMyStruct1Async(Test.MyStruct1 value, Ice.Current current)845                     opMyStruct1Async(Test.MyStruct1 value, Ice.Current current)
846                     {
847                         return Task.FromResult(value);
848                     }
849 
850                     public Task<string[]>
opStringLiteralsAsync(Ice.Current current)851                     opStringLiteralsAsync(Ice.Current current)
852                     {
853                         return Task.FromResult<string[]>(new string[]
854                             {
855                                 Test.s0.value,
856                                 Test.s1.value,
857                                 Test.s2.value,
858                                 Test.s3.value,
859                                 Test.s4.value,
860                                 Test.s5.value,
861                                 Test.s6.value,
862                                 Test.s7.value,
863                                 Test.s8.value,
864                                 Test.s9.value,
865                                 Test.s10.value,
866 
867                                 Test.sw0.value,
868                                 Test.sw1.value,
869                                 Test.sw2.value,
870                                 Test.sw3.value,
871                                 Test.sw4.value,
872                                 Test.sw5.value,
873                                 Test.sw6.value,
874                                 Test.sw7.value,
875                                 Test.sw8.value,
876                                 Test.sw9.value,
877                                 Test.sw10.value,
878 
879                                 Test.ss0.value,
880                                 Test.ss1.value,
881                                 Test.ss2.value,
882                                 Test.ss3.value,
883                                 Test.ss4.value,
884                                 Test.ss5.value,
885 
886                                 Test.su0.value,
887                                 Test.su1.value,
888                                 Test.su2.value
889                             });
890                     }
891 
892                     public Task<string[]>
opWStringLiteralsAsync(Ice.Current current)893                     opWStringLiteralsAsync(Ice.Current current)
894                     {
895                         return Task.FromResult<string[]>(new string[]
896                             {
897                                 Test.s0.value,
898                                 Test.s1.value,
899                                 Test.s2.value,
900                                 Test.s3.value,
901                                 Test.s4.value,
902                                 Test.s5.value,
903                                 Test.s6.value,
904                                 Test.s7.value,
905                                 Test.s8.value,
906                                 Test.s9.value,
907                                 Test.s10.value,
908 
909                                 Test.sw0.value,
910                                 Test.sw1.value,
911                                 Test.sw2.value,
912                                 Test.sw3.value,
913                                 Test.sw4.value,
914                                 Test.sw5.value,
915                                 Test.sw6.value,
916                                 Test.sw7.value,
917                                 Test.sw8.value,
918                                 Test.sw9.value,
919                                 Test.sw10.value,
920 
921                                 Test.ss0.value,
922                                 Test.ss1.value,
923                                 Test.ss2.value,
924                                 Test.ss3.value,
925                                 Test.ss4.value,
926                                 Test.ss5.value,
927 
928                                 Test.su0.value,
929                                 Test.su1.value,
930                                 Test.su2.value
931                             });
932                     }
933 
934                     public async Task<Test.MyClass_OpMStruct1MarshaledResult>
opMStruct1Async(Ice.Current current)935                     opMStruct1Async(Ice.Current current)
936                     {
937                         await Task.Delay(0);
938                         return new Test.MyClass_OpMStruct1MarshaledResult(new Test.Structure(), current);
939                     }
940 
941                     public async Task<Test.MyClass_OpMStruct2MarshaledResult>
opMStruct2Async(Test.Structure p1, Ice.Current current)942                     opMStruct2Async(Test.Structure p1, Ice.Current current)
943                     {
944                         await Task.Delay(0);
945                         return new Test.MyClass_OpMStruct2MarshaledResult(p1, p1, current);
946                     }
947 
948                     public async Task<Test.MyClass_OpMSeq1MarshaledResult>
opMSeq1Async(Ice.Current current)949                     opMSeq1Async(Ice.Current current)
950                     {
951                         await Task.Delay(0);
952                         return new Test.MyClass_OpMSeq1MarshaledResult(new string[0], current);
953                     }
954 
955                     public async Task<Test.MyClass_OpMSeq2MarshaledResult>
opMSeq2Async(string[] p1, Ice.Current current)956                     opMSeq2Async(string[] p1, Ice.Current current)
957                     {
958                         await Task.Delay(0);
959                         return new Test.MyClass_OpMSeq2MarshaledResult(p1, p1, current);
960                     }
961 
962                     public async Task<Test.MyClass_OpMDict1MarshaledResult>
opMDict1Async(Ice.Current current)963                     opMDict1Async(Ice.Current current)
964                     {
965                         await Task.Delay(0);
966                         return new Test.MyClass_OpMDict1MarshaledResult(new Dictionary<string, string>(), current);
967                     }
968 
969                     public async Task<Test.MyClass_OpMDict2MarshaledResult>
opMDict2Async(Dictionary<string, string> p1, Ice.Current current)970                     opMDict2Async(Dictionary<string, string> p1, Ice.Current current)
971                     {
972                         await Task.Delay(0);
973                         return new Test.MyClass_OpMDict2MarshaledResult(p1, p1, current);
974                     }
975 
976                     private Thread_opVoid _opVoidThread;
977                     private int _opByteSOnewayCallCount = 0;
978                 }
979             }
980         }
981     }
982 }
983