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