1 // 2 // Copyright (c) ZeroC, Inc. All rights reserved. 3 // 4 5 using System; 6 using System.Collections.Generic; 7 using System.Diagnostics; 8 using System.Runtime.Serialization; 9 using System.Threading; 10 using System.Threading.Tasks; 11 using System.ComponentModel; 12 13 using IceUtilInternal; 14 using IceInternal; 15 16 namespace Ice 17 { 18 /// <summary> 19 /// Delegate for a successful <code>ice_isA</code> invocation. 20 /// <param name="ret">True if the remote object supports the type, false otherwise.</param> 21 /// </summary> Callback_Object_ice_isA(bool ret)22 public delegate void Callback_Object_ice_isA(bool ret); 23 24 /// <summary> 25 /// Delegate for a successful <code>ice_ids</code> invocation. 26 /// <param name="ret">The array of Slice type ids supported by the remote object.</param> 27 /// </summary> Callback_Object_ice_ids(string[] ret)28 public delegate void Callback_Object_ice_ids(string[] ret); 29 30 /// <summary> 31 /// Delegate for a successful <code>ice_id</code> invocation. 32 /// <param name="ret">The Slice type id of the most-derived interface supported by the remote object.</param> 33 /// </summary> Callback_Object_ice_id(string ret)34 public delegate void Callback_Object_ice_id(string ret); 35 36 /// <summary> 37 /// Delegate for a successful <code>ice_ping</code> invocation. 38 /// </summary> Callback_Object_ice_ping()39 public delegate void Callback_Object_ice_ping(); 40 41 /// <summary> 42 /// Delegate for a successful <code>ice_invoke</code> invocation. 43 /// <param name="ret">True if the invocation succeeded, or false if the invocation 44 /// raised a user exception.</param> 45 /// <param name="outEncaps">The encoded out-parameters or user exception.</param> 46 /// </summary> Callback_Object_ice_invoke(bool ret, byte[] outEncaps)47 public delegate void Callback_Object_ice_invoke(bool ret, byte[] outEncaps); 48 49 /// <summary> 50 /// Delegate for a successful <code>ice_getConnection</code> invocation. 51 /// <param name="ret">The connection used by the proxy.</param> 52 /// </summary> Callback_Object_ice_getConnection(Connection ret)53 public delegate void Callback_Object_ice_getConnection(Connection ret); 54 55 /// <summary> 56 /// Value type to allow differenciate between a context that is explicity set to 57 /// empty (empty or null dictionary) and a context that has non been set. 58 /// </summary> 59 public struct OptionalContext 60 { OptionalContextIce.OptionalContext61 private OptionalContext(Dictionary<string, string> ctx) 62 { 63 _ctx = ctx == null ? _emptyContext : ctx; 64 } 65 66 /// <summary> 67 /// Implicit conversion between Dictionary<string, string> and 68 /// OptionalContext. 69 /// </summary> 70 /// <param name="ctx">Dictionary to convert.</param> 71 /// <returns>OptionalContext value representing the dictionary</returns> operator OptionalContextIce.OptionalContext72 public static implicit operator OptionalContext(Dictionary<string, string> ctx) 73 { 74 return new OptionalContext(ctx); 75 } 76 77 /// <summary> 78 /// Implicit conversion between OptionalContext and 79 /// Dictionary<string, string> 80 /// </summary> 81 /// <param name="value">OptionalContext value to convert</param> 82 /// <returns>The Dictionary object.</returns> operator Dictionary<string, string>Ice.OptionalContext83 public static implicit operator Dictionary<string, string>(OptionalContext value) 84 { 85 return value._ctx; 86 } 87 88 private Dictionary<string, string> _ctx; 89 static private Dictionary<string, string> _emptyContext = new Dictionary<string, string>(); 90 } 91 92 /// <summary> 93 /// Base interface of all object proxies. 94 /// </summary> 95 public interface ObjectPrx 96 { 97 /// <summary> 98 /// Returns the communicator that created this proxy. 99 /// </summary> 100 /// <returns>The communicator that created this proxy.</returns> ice_getCommunicator()101 Communicator ice_getCommunicator(); 102 103 /// <summary> 104 /// Tests whether this object supports a specific Slice interface. 105 /// </summary> 106 /// <param name="id">The type ID of the Slice interface to test against.</param> 107 /// <param name="context">The context dictionary for the invocation.</param> 108 /// <returns>True if the target object has the interface specified by id or derives 109 /// from the interface specified by id.</returns> ice_isA(string id, OptionalContext context = new OptionalContext())110 bool ice_isA(string id, OptionalContext context = new OptionalContext()); 111 112 /// <summary> 113 /// Tests whether this object supports a specific Slice interface. 114 /// </summary> 115 /// <param name="id">The type ID of the Slice interface to test against.</param> 116 /// <param name="context">The context dictionary for the invocation.</param> 117 /// <param name="progress">Sent progress provider.</param> 118 /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> 119 /// <returns>The task object representing the asynchronous operation.</returns> ice_isAAsync(string id, OptionalContext context = new OptionalContext(), IProgress<bool> progress = null, CancellationToken cancel = new CancellationToken())120 Task<bool> ice_isAAsync(string id, 121 OptionalContext context = new OptionalContext(), 122 IProgress<bool> progress = null, 123 CancellationToken cancel = new CancellationToken()); 124 /// <summary> 125 /// Tests whether this object supports a specific Slice interface. 126 /// </summary> 127 /// <param name="id">The type ID of the Slice interface to test against.</param> 128 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 129 /// <param name="cookie">Application-specific data to be stored in the result.</param> 130 /// <returns>An asynchronous result object.</returns> begin_ice_isA(string id, AsyncCallback callback, object cookie)131 AsyncResult begin_ice_isA(string id, AsyncCallback callback, object cookie); 132 133 /// <summary> 134 /// Tests whether this object supports a specific Slice interface. 135 /// </summary> 136 /// <param name="id">The type ID of the Slice interface to test against.</param> 137 /// <param name="context">The context dictionary for the invocation.</param> 138 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 139 /// <param name="cookie">Application-specific data to be stored in the result.</param> 140 /// <returns>An asynchronous result object.</returns> begin_ice_isA(string id, OptionalContext context, AsyncCallback callback, object cookie)141 AsyncResult begin_ice_isA(string id, OptionalContext context, AsyncCallback callback, object cookie); 142 143 /// <summary> 144 /// Tests whether this object supports a specific Slice interface. 145 /// </summary> 146 /// <param name="id">The type ID of the Slice interface to test against.</param> 147 /// <param name="context">The context dictionary for the invocation.</param> 148 /// <returns>An asynchronous result object.</returns> begin_ice_isA(string id, OptionalContext context = new OptionalContext())149 AsyncResult<Callback_Object_ice_isA> begin_ice_isA(string id, OptionalContext context = new OptionalContext()); 150 151 /// <summary> 152 /// Tests whether this object supports a specific Slice interface. 153 /// </summary> 154 /// <param name="result">The asynchronous result object returned by <code>begin_ice_isA</code>.</param> 155 /// <returns>True if the object supports the Slice interface, false otherwise.</returns> end_ice_isA(AsyncResult result)156 bool end_ice_isA(AsyncResult result); 157 158 /// <summary> 159 /// Tests whether the target object of this proxy can be reached. 160 /// </summary> 161 /// <param name="context">The context dictionary for the invocation.</param> ice_ping(OptionalContext context = new OptionalContext())162 void ice_ping(OptionalContext context = new OptionalContext()); 163 164 /// <summary> 165 /// Tests whether the target object of this proxy can be reached. 166 /// </summary> 167 /// <param name="context">The context dictionary for the invocation.</param> 168 /// <param name="progress">Sent progress provider.</param> 169 /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> 170 /// <returns>The task object representing the asynchronous operation.</returns> ice_pingAsync(OptionalContext context = new OptionalContext(), IProgress<bool> progress = null, CancellationToken cancel = new CancellationToken())171 Task ice_pingAsync(OptionalContext context = new OptionalContext(), 172 IProgress<bool> progress = null, 173 CancellationToken cancel = new CancellationToken()); 174 175 /// <summary> 176 /// Tests whether the target object of this proxy can be reached. 177 /// </summary> 178 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 179 /// <param name="cookie">Application-specific data to be stored in the result.</param> 180 /// <returns>An asynchronous result object.</returns> begin_ice_ping(AsyncCallback callback, object cookie)181 AsyncResult begin_ice_ping(AsyncCallback callback, object cookie); 182 183 /// <summary> 184 /// Tests whether the target object of this proxy can be reached. 185 /// </summary> 186 /// <param name="context">The context dictionary for the invocation.</param> 187 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 188 /// <param name="cookie">Application-specific data to be stored in the result.</param> 189 /// <returns>An asynchronous result object.</returns> begin_ice_ping(OptionalContext context, AsyncCallback callback, object cookie)190 AsyncResult begin_ice_ping(OptionalContext context, AsyncCallback callback, object cookie); 191 192 /// <summary> 193 /// Tests whether the target object of this proxy can be reached. 194 /// </summary> 195 /// <param name="context">The context dictionary for the invocation.</param> 196 /// <returns>An asynchronous result object.</returns> begin_ice_ping(OptionalContext context = new OptionalContext())197 AsyncResult<Callback_Object_ice_ping> begin_ice_ping(OptionalContext context = new OptionalContext()); 198 199 /// <summary> 200 /// Tests whether the target object of this proxy can be reached. 201 /// </summary> 202 /// <param name="result">The asynchronous result object returned by <code>begin_ice_ping</code>.</param> end_ice_ping(AsyncResult result)203 void end_ice_ping(AsyncResult result); 204 205 /// <summary> 206 /// Returns the Slice type IDs of the interfaces supported by the target object of this proxy. 207 /// </summary> 208 /// <param name="context">The context dictionary for the invocation.</param> 209 /// <returns>The Slice type IDs of the interfaces supported by the target object, in base-to-derived 210 /// order. The first element of the returned array is always ::Ice::Object.</returns> ice_ids(OptionalContext context = new OptionalContext())211 string[] ice_ids(OptionalContext context = new OptionalContext()); 212 213 /// <summary> 214 /// Returns the Slice type IDs of the interfaces supported by the target object of this proxy. 215 /// </summary> 216 /// <param name="context">The context dictionary for the invocation.</param> 217 /// <param name="progress">Sent progress provider.</param> 218 /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> 219 /// <returns>The task object representing the asynchronous operation.</returns> ice_idsAsync(OptionalContext context = new OptionalContext(), IProgress<bool> progress = null, CancellationToken cancel = new CancellationToken())220 Task<string[]> ice_idsAsync(OptionalContext context = new OptionalContext(), 221 IProgress<bool> progress = null, 222 CancellationToken cancel = new CancellationToken()); 223 224 /// <summary> 225 /// Returns the Slice type IDs of the interfaces supported by the target object of this proxy. 226 /// </summary> 227 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 228 /// <param name="cookie">Application-specific data to be stored in the result.</param> 229 /// <returns>An asynchronous result object.</returns> begin_ice_ids(AsyncCallback callback, object cookie)230 AsyncResult begin_ice_ids(AsyncCallback callback, object cookie); 231 232 /// <summary> 233 /// Returns the Slice type IDs of the interfaces supported by the target object of this proxy. 234 /// </summary> 235 /// <param name="context">The context dictionary for the invocation.</param> 236 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 237 /// <param name="cookie">Application-specific data to be stored in the result.</param> 238 /// <returns>An asynchronous result object.</returns> begin_ice_ids(OptionalContext context, AsyncCallback callback, object cookie)239 AsyncResult begin_ice_ids(OptionalContext context, AsyncCallback callback, object cookie); 240 241 /// <summary> 242 /// Returns the Slice type IDs of the interfaces supported by the target object of this proxy. 243 /// </summary> 244 /// <param name="context">The context dictionary for the invocation.</param> 245 /// <returns>An asynchronous result object.</returns> begin_ice_ids(OptionalContext context = new OptionalContext())246 AsyncResult<Callback_Object_ice_ids> begin_ice_ids(OptionalContext context = new OptionalContext()); 247 248 /// <summary> 249 /// Returns the Slice type IDs of the interfaces supported by the target object of this proxy. 250 /// </summary> 251 /// <param name="result">The asynchronous result object returned by <code>begin_ice_ids</code>.</param> 252 /// <returns>The Slice type IDs of the interfaces supported by the target object, in base-to-derived 253 /// order. The first element of the returned array is always ::Ice::Object.</returns> end_ice_ids(AsyncResult result)254 string[] end_ice_ids(AsyncResult result); 255 256 /// <summary> 257 /// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. 258 /// </summary> 259 /// <param name="context">The context dictionary for the invocation.</param> 260 /// <returns>The Slice type ID of the most-derived interface.</returns> ice_id(OptionalContext context = new OptionalContext())261 string ice_id(OptionalContext context = new OptionalContext()); 262 263 /// <summary> 264 /// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. 265 /// </summary> 266 /// <param name="context">The context dictionary for the invocation.</param> 267 /// <param name="progress">Sent progress provider.</param> 268 /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> 269 /// <returns>The task object representing the asynchronous operation.</returns> ice_idAsync(OptionalContext context = new OptionalContext(), IProgress<bool> progress = null, CancellationToken cancel = new CancellationToken())270 Task<string> ice_idAsync(OptionalContext context = new OptionalContext(), 271 IProgress<bool> progress = null, 272 CancellationToken cancel = new CancellationToken()); 273 274 /// <summary> 275 /// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. 276 /// </summary> 277 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 278 /// <param name="cookie">Application-specific data to be stored in the result.</param> 279 /// <returns>An asynchronous result object.</returns> begin_ice_id(AsyncCallback callback, object cookie)280 AsyncResult begin_ice_id(AsyncCallback callback, object cookie); 281 282 /// <summary> 283 /// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. 284 /// </summary> 285 /// <param name="context">The context dictionary for the invocation.</param> 286 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 287 /// <param name="cookie">Application-specific data to be stored in the result.</param> 288 /// <returns>An asynchronous result object.</returns> begin_ice_id(OptionalContext context, AsyncCallback callback, object cookie)289 AsyncResult begin_ice_id(OptionalContext context, AsyncCallback callback, object cookie); 290 291 /// <summary> 292 /// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. 293 /// </summary> 294 /// <param name="context">The context dictionary for the invocation.</param> 295 /// <returns>An asynchronous result object.</returns> begin_ice_id(OptionalContext context = new OptionalContext())296 AsyncResult<Callback_Object_ice_id> begin_ice_id(OptionalContext context = new OptionalContext()); 297 298 /// <summary> 299 /// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. 300 /// </summary> 301 /// <param name="result">The asynchronous result object returned by <code>begin_ice_id</code>.</param> 302 /// <returns>The Slice type ID of the most-derived interface.</returns> end_ice_id(AsyncResult result)303 string end_ice_id(AsyncResult result); 304 305 /// <summary> 306 /// Invokes an operation dynamically. 307 /// </summary> 308 /// <param name="operation">The name of the operation to invoke.</param> 309 /// <param name="mode">The operation mode (normal or idempotent).</param> 310 /// <param name="inEncaps">The encoded in-parameters for the operation.</param> 311 /// <param name="outEncaps">The encoded out-paramaters and return value 312 /// for the operation. The return value follows any out-parameters.</param> 313 /// <param name="context">The context dictionary for the invocation.</param> 314 /// <returns>If the operation completed successfully, the return value 315 /// is true. If the operation raises a user exception, 316 /// the return value is false; in this case, outEncaps 317 /// contains the encoded user exception. If the operation raises a run-time exception, 318 /// it throws it directly.</returns> ice_invoke(string operation, OperationMode mode, byte[] inEncaps, out byte[] outEncaps, OptionalContext context = new OptionalContext())319 bool ice_invoke(string operation, OperationMode mode, byte[] inEncaps, out byte[] outEncaps, 320 OptionalContext context = new OptionalContext()); 321 322 /// <summary> 323 /// Invokes an operation dynamically. 324 /// </summary> 325 /// <param name="operation">The name of the operation to invoke.</param> 326 /// <param name="mode">The operation mode (normal or idempotent).</param> 327 /// <param name="inEncaps">The encoded in-parameters for the operation.</param> 328 /// <param name="context">The context dictionary for the invocation.</param> 329 /// <param name="progress">Sent progress provider.</param> 330 /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> 331 /// <returns>The task object representing the asynchronous operation.</returns> 332 Task<Object_Ice_invokeResult> ice_invokeAsync(string operation, OperationMode mode, byte[] inEncaps, OptionalContext context = new OptionalContext(), IProgress<bool> progress = null, CancellationToken cancel = new CancellationToken())333 ice_invokeAsync(string operation, 334 OperationMode mode, 335 byte[] inEncaps, 336 OptionalContext context = new OptionalContext(), 337 IProgress<bool> progress = null, 338 CancellationToken cancel = new CancellationToken()); 339 340 /// <summary> 341 /// Invokes an operation dynamically. 342 /// </summary> 343 /// <param name="operation">The name of the operation to invoke.</param> 344 /// <param name="mode">The operation mode (normal or idempotent).</param> 345 /// <param name="inEncaps">The encoded in-parameters for the operation.</param> 346 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 347 /// <param name="cookie">Application-specific data to be stored in the result.</param> 348 /// <returns>An asynchronous result object.</returns> begin_ice_invoke(string operation, OperationMode mode, byte[] inEncaps, AsyncCallback callback, object cookie)349 AsyncResult begin_ice_invoke(string operation, 350 OperationMode mode, 351 byte[] inEncaps, 352 AsyncCallback callback, 353 object cookie); 354 355 /// <summary> 356 /// Invokes an operation dynamically. 357 /// </summary> 358 /// <param name="operation">The name of the operation to invoke.</param> 359 /// <param name="mode">The operation mode (normal or idempotent).</param> 360 /// <param name="inEncaps">The encoded in-parameters for the operation.</param> 361 /// <param name="context">The context dictionary for the invocation.</param> 362 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 363 /// <param name="cookie">Application-specific data to be stored in the result.</param> 364 /// <returns>An asynchronous result object.</returns> begin_ice_invoke(string operation, OperationMode mode, byte[] inEncaps, OptionalContext context, AsyncCallback callback, object cookie)365 AsyncResult begin_ice_invoke(string operation, 366 OperationMode mode, 367 byte[] inEncaps, 368 OptionalContext context, 369 AsyncCallback callback, 370 object cookie); 371 372 /// <summary> 373 /// Invokes an operation dynamically. 374 /// </summary> 375 /// <param name="operation">The name of the operation to invoke.</param> 376 /// <param name="mode">The operation mode (normal or idempotent).</param> 377 /// <param name="inEncaps">The encoded in-parameters for the operation.</param> 378 /// <param name="context">The context dictionary for the invocation.</param> 379 /// <returns>An asynchronous result object.</returns> begin_ice_invoke(string operation, OperationMode mode, byte[] inEncaps, OptionalContext context = new OptionalContext())380 AsyncResult<Callback_Object_ice_invoke> begin_ice_invoke(string operation, 381 OperationMode mode, 382 byte[] inEncaps, 383 OptionalContext context = new OptionalContext()); 384 385 /// <summary> 386 /// Completes a dynamic invocation. 387 /// </summary> 388 /// <param name="outEncaps">The encoded out parameters or user exception.</param> 389 /// <param name="result">The asynchronous result object returned by <code>begin_ice_invoke</code>.</param> 390 /// <returns>If the operation completed successfully, the return value 391 /// is true. If the operation raises a user exception, 392 /// the return value is false; in this case, outEncaps 393 /// contains the encoded user exception. If the operation raises a run-time exception, 394 /// it throws it directly.</returns> end_ice_invoke(out byte[] outEncaps, AsyncResult result)395 bool end_ice_invoke(out byte[] outEncaps, AsyncResult result); 396 397 /// <summary> 398 /// Returns the identity embedded in this proxy. 399 /// <returns>The identity of the target object.</returns> 400 /// </summary> ice_getIdentity()401 Identity ice_getIdentity(); 402 403 /// <summary> 404 /// Creates a new proxy that is identical to this proxy, except for the per-proxy context. 405 /// <param name="newIdentity">The identity for the new proxy.</param> 406 /// <returns>The proxy with the new identity.</returns> 407 /// </summary> ice_identity(Identity newIdentity)408 ObjectPrx ice_identity(Identity newIdentity); 409 410 /// <summary> 411 /// Returns the per-proxy context for this proxy. 412 /// </summary> 413 /// <returns>The per-proxy context. If the proxy does not have a per-proxy (implicit) context, the return value 414 /// is null.</returns> ice_getContext()415 Dictionary<string, string> ice_getContext(); 416 417 /// <summary> 418 /// Creates a new proxy that is identical to this proxy, except for the per-proxy context. 419 /// </summary> 420 /// <param name="newContext">The context for the new proxy.</param> 421 /// <returns>The proxy with the new per-proxy context.</returns> ice_context(Dictionary<string, string> newContext)422 ObjectPrx ice_context(Dictionary<string, string> newContext); 423 424 /// <summary> 425 /// Returns the facet for this proxy. 426 /// </summary> 427 /// <returns>The facet for this proxy. If the proxy uses the default facet, the return value is the 428 /// empty string.</returns> ice_getFacet()429 string ice_getFacet(); 430 431 /// <summary> 432 /// Creates a new proxy that is identical to this proxy, except for the facet. 433 /// </summary> 434 /// <param name="newFacet">The facet for the new proxy.</param> 435 /// <returns>The proxy with the new facet.</returns> ice_facet(string newFacet)436 ObjectPrx ice_facet(string newFacet); 437 438 /// <summary> 439 /// Returns the adapter ID for this proxy. 440 /// </summary> 441 /// <returns>The adapter ID. If the proxy does not have an adapter ID, the return value is the 442 /// empty string.</returns> ice_getAdapterId()443 string ice_getAdapterId(); 444 445 /// <summary> 446 /// Creates a new proxy that is identical to this proxy, except for the adapter ID. 447 /// </summary> 448 /// <param name="newAdapterId">The adapter ID for the new proxy.</param> 449 /// <returns>The proxy with the new adapter ID.</returns> ice_adapterId(string newAdapterId)450 ObjectPrx ice_adapterId(string newAdapterId); 451 452 /// <summary> 453 /// Returns the endpoints used by this proxy. 454 /// </summary> 455 /// <returns>The endpoints used by this proxy.</returns> ice_getEndpoints()456 Endpoint[] ice_getEndpoints(); 457 458 /// <summary> 459 /// Creates a new proxy that is identical to this proxy, except for the endpoints. 460 /// </summary> 461 /// <param name="newEndpoints">The endpoints for the new proxy.</param> 462 /// <returns>The proxy with the new endpoints.</returns> ice_endpoints(Endpoint[] newEndpoints)463 ObjectPrx ice_endpoints(Endpoint[] newEndpoints); 464 465 /// <summary> 466 /// Returns the locator cache timeout of this proxy. 467 /// </summary> 468 /// <returns>The locator cache timeout value (in seconds).</returns> ice_getLocatorCacheTimeout()469 int ice_getLocatorCacheTimeout(); 470 471 /// <summary> 472 /// Creates a new proxy that is identical to this proxy, except for the locator cache timeout. 473 /// </summary> 474 /// <param name="timeout">The new locator cache timeout (in seconds).</param> ice_locatorCacheTimeout(int timeout)475 ObjectPrx ice_locatorCacheTimeout(int timeout); 476 477 /// <summary> 478 /// Creates a new proxy that is identical to this proxy, except for the invocation timeout. 479 /// </summary> 480 /// <param name="timeout">The new invocation timeout (in seconds).</param> ice_invocationTimeout(int timeout)481 ObjectPrx ice_invocationTimeout(int timeout); 482 483 /// <summary> 484 /// Returns the invocation timeout of this proxy. 485 /// </summary> 486 /// <returns>The invocation timeout value (in seconds).</returns> ice_getInvocationTimeout()487 int ice_getInvocationTimeout(); 488 489 /// <summary> 490 /// Returns whether this proxy caches connections. 491 /// </summary> 492 /// <returns>True if this proxy caches connections; false, otherwise.</returns> ice_isConnectionCached()493 bool ice_isConnectionCached(); 494 495 /// <summary> 496 /// Creates a new proxy that is identical to this proxy, except for connection caching. 497 /// </summary> 498 /// <param name="newCache">True if the new proxy should cache connections; false, otherwise.</param> 499 /// <returns>The new proxy with the specified caching policy.</returns> ice_connectionCached(bool newCache)500 ObjectPrx ice_connectionCached(bool newCache); 501 502 /// <summary> 503 /// Returns how this proxy selects endpoints (randomly or ordered). 504 /// </summary> 505 /// <returns>The endpoint selection policy.</returns> ice_getEndpointSelection()506 EndpointSelectionType ice_getEndpointSelection(); 507 508 /// <summary> 509 /// Creates a new proxy that is identical to this proxy, except for the endpoint selection policy. 510 /// </summary> 511 /// <param name="newType">The new endpoint selection policy.</param> 512 /// <returns>The new proxy with the specified endpoint selection policy.</returns> ice_endpointSelection(EndpointSelectionType newType)513 ObjectPrx ice_endpointSelection(EndpointSelectionType newType); 514 515 /// <summary> 516 /// Returns whether this proxy communicates only via secure endpoints. 517 /// </summary> 518 /// <returns>True if this proxy communicates only vi secure endpoints; false, otherwise.</returns> ice_isSecure()519 bool ice_isSecure(); 520 521 /// <summary> 522 /// Creates a new proxy that is identical to this proxy, except for how it selects endpoints. 523 /// </summary> 524 /// <param name="b"> If b is true, only endpoints that use a secure transport are 525 /// used by the new proxy. If b is false, the returned proxy uses both secure and insecure 526 /// endpoints.</param> 527 /// <returns>The new proxy with the specified selection policy.</returns> ice_secure(bool b)528 ObjectPrx ice_secure(bool b); 529 530 /// <summary> 531 /// Creates a new proxy that is identical to this proxy, except for the encoding used to marshal 532 /// parameters. 533 /// </summary> 534 /// <param name="e">The encoding version to use to marshal requests parameters.</param> 535 /// <returns>The new proxy with the specified encoding version.</returns> ice_encodingVersion(EncodingVersion e)536 ObjectPrx ice_encodingVersion(EncodingVersion e); 537 538 /// <summary>Returns the encoding version used to marshal requests parameters.</summary> 539 /// <returns>The encoding version.</returns> ice_getEncodingVersion()540 EncodingVersion ice_getEncodingVersion(); 541 542 /// <summary> 543 /// Returns whether this proxy prefers secure endpoints. 544 /// </summary> 545 /// <returns>True if the proxy always attempts to invoke via secure endpoints before it 546 /// attempts to use insecure endpoints; false, otherwise.</returns> ice_isPreferSecure()547 bool ice_isPreferSecure(); 548 549 /// <summary> 550 /// Creates a new proxy that is identical to this proxy, except for its endpoint selection policy. 551 /// </summary> 552 /// <param name="b">If b is true, the new proxy will use secure endpoints for invocations 553 /// and only use insecure endpoints if an invocation cannot be made via secure endpoints. If b is 554 /// false, the proxy prefers insecure endpoints to secure ones.</param> 555 /// <returns>The new proxy with the new endpoint selection policy.</returns> ice_preferSecure(bool b)556 ObjectPrx ice_preferSecure(bool b); 557 558 /// <summary> 559 /// Returns the router for this proxy. 560 /// </summary> 561 /// <returns>The router for the proxy. If no router is configured for the proxy, the return value 562 /// is null.</returns> ice_getRouter()563 RouterPrx ice_getRouter(); 564 565 /// <summary> 566 /// Creates a new proxy that is identical to this proxy, except for the router. 567 /// </summary> 568 /// <param name="router">The router for the new proxy.</param> 569 /// <returns>The new proxy with the specified router.</returns> ice_router(RouterPrx router)570 ObjectPrx ice_router(RouterPrx router); 571 572 /// <summary> 573 /// Returns the locator for this proxy. 574 /// </summary> 575 /// <returns>The locator for this proxy. If no locator is configured, the return value is null.</returns> ice_getLocator()576 LocatorPrx ice_getLocator(); 577 578 /// <summary> 579 /// Creates a new proxy that is identical to this proxy, except for the locator. 580 /// </summary> 581 /// <param name="locator">The locator for the new proxy.</param> 582 /// <returns>The new proxy with the specified locator.</returns> ice_locator(LocatorPrx locator)583 ObjectPrx ice_locator(LocatorPrx locator); 584 585 /// <summary> 586 /// Returns whether this proxy uses collocation optimization. 587 /// </summary> 588 /// <returns>True if the proxy uses collocation optimization; false, otherwise.</returns> ice_isCollocationOptimized()589 bool ice_isCollocationOptimized(); 590 591 /// <summary> 592 /// Creates a new proxy that is identical to this proxy, except for collocation optimization. 593 /// </summary> 594 /// <param name="b">True if the new proxy enables collocation optimization; false, otherwise.</param> 595 /// <returns>The new proxy the specified collocation optimization.</returns> ice_collocationOptimized(bool b)596 ObjectPrx ice_collocationOptimized(bool b); 597 598 /// <summary> 599 /// Creates a new proxy that is identical to this proxy, but uses twoway invocations. 600 /// </summary> 601 /// <returns>A new proxy that uses twoway invocations.</returns> ice_twoway()602 ObjectPrx ice_twoway(); 603 604 /// <summary> 605 /// Returns whether this proxy uses twoway invocations. 606 /// </summary> 607 /// <returns>True if this proxy uses twoway invocations; false, otherwise.</returns> ice_isTwoway()608 bool ice_isTwoway(); 609 610 /// <summary> 611 /// Creates a new proxy that is identical to this proxy, but uses oneway invocations. 612 /// </summary> 613 /// <returns>A new proxy that uses oneway invocations.</returns> ice_oneway()614 ObjectPrx ice_oneway(); 615 616 /// <summary> 617 /// Returns whether this proxy uses oneway invocations. 618 /// </summary> 619 /// <returns>True if this proxy uses oneway invocations; false, otherwise.</returns> ice_isOneway()620 bool ice_isOneway(); 621 622 /// <summary> 623 /// Creates a new proxy that is identical to this proxy, but uses batch oneway invocations. 624 /// </summary> 625 /// <returns>A new proxy that uses batch oneway invocations.</returns> ice_batchOneway()626 ObjectPrx ice_batchOneway(); 627 628 /// <summary> 629 /// Returns whether this proxy uses batch oneway invocations. 630 /// </summary> 631 /// <returns>True if this proxy uses batch oneway invocations; false, otherwise.</returns> ice_isBatchOneway()632 bool ice_isBatchOneway(); 633 634 /// <summary> 635 /// Creates a new proxy that is identical to this proxy, but uses datagram invocations. 636 /// </summary> 637 /// <returns>A new proxy that uses datagram invocations.</returns> ice_datagram()638 ObjectPrx ice_datagram(); 639 640 /// <summary> 641 /// Returns whether this proxy uses datagram invocations. 642 /// </summary> 643 /// <returns>True if this proxy uses datagram invocations; false, otherwise.</returns> ice_isDatagram()644 bool ice_isDatagram(); 645 646 /// <summary> 647 /// Creates a new proxy that is identical to this proxy, but uses batch datagram invocations. 648 /// </summary> 649 /// <returns>A new proxy that uses batch datagram invocations.</returns> ice_batchDatagram()650 ObjectPrx ice_batchDatagram(); 651 652 /// <summary> 653 /// Returns whether this proxy uses batch datagram invocations. 654 /// </summary> 655 /// <returns>True if this proxy uses batch datagram invocations; false, otherwise.</returns> ice_isBatchDatagram()656 bool ice_isBatchDatagram(); 657 658 /// <summary> 659 /// Creates a new proxy that is identical to this proxy, except for compression. 660 /// </summary> 661 /// <param name="co">True enables compression for the new proxy; false disables compression.</param> 662 /// <returns>A new proxy with the specified compression setting.</returns> ice_compress(bool co)663 ObjectPrx ice_compress(bool co); 664 665 /// <summary> 666 /// Obtains the compression override setting of this proxy. 667 /// </summary> 668 /// <returns>The compression override setting. If no optional value is present, no override is 669 /// set. Otherwise, true if compression is enabled, false otherwise.</returns> ice_getCompress()670 Ice.Optional<bool> ice_getCompress(); 671 672 /// <summary> 673 /// Creates a new proxy that is identical to this proxy, except for its timeout setting. 674 /// </summary> 675 /// <param name="t">The timeout for the new proxy in milliseconds.</param> 676 /// <returns>A new proxy with the specified timeout.</returns> ice_timeout(int t)677 ObjectPrx ice_timeout(int t); 678 679 /// <summary> 680 /// Obtains the timeout override of this proxy. 681 /// </summary> 682 /// <returns>The timeout override. If no optional value is present, no override is set. Otherwise, 683 /// returns the timeout override value.</returns> ice_getTimeout()684 Ice.Optional<int> ice_getTimeout(); 685 686 /// <summary> 687 /// Creates a new proxy that is identical to this proxy, except for its connection ID. 688 /// </summary> 689 /// <param name="connectionId">The connection ID for the new proxy. An empty string removes the 690 /// connection ID.</param> 691 /// <returns>A new proxy with the specified connection ID.</returns> ice_connectionId(string connectionId)692 ObjectPrx ice_connectionId(string connectionId); 693 694 /// <summary> 695 /// Returns the connection id of this proxy. 696 /// </summary> 697 /// <returns>The connection id.</returns> ice_getConnectionId()698 string ice_getConnectionId(); 699 700 /// <summary> 701 /// Returns a proxy that is identical to this proxy, except it's a fixed proxy bound 702 /// the given connection. 703 /// </summary> 704 /// <param name="connection">The fixed proxy connection.</param> 705 /// <returns>A fixed proxy bound to the given connection.</returns> ice_fixed(Ice.Connection connection)706 ObjectPrx ice_fixed(Ice.Connection connection); 707 708 /// <summary> 709 /// Returns the Connection for this proxy. If the proxy does not yet have an established connection, 710 /// it first attempts to create a connection. 711 /// </summary> 712 /// <returns>The Connection for this proxy.</returns> 713 /// <exception name="CollocationOptimizationException">If the proxy uses collocation optimization and denotes a 714 /// collocated object.</exception> ice_getConnection()715 Connection ice_getConnection(); 716 717 /// <summary> 718 /// Asynchronously gets the connection for this proxy. 719 /// </summary> 720 /// <param name="progress">Sent progress provider.</param> 721 /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> 722 /// <returns>The task object representing the asynchronous operation.</returns> ice_getConnectionAsync(IProgress<bool> progress = null, CancellationToken cancel = new CancellationToken())723 Task<Connection> ice_getConnectionAsync(IProgress<bool> progress = null, 724 CancellationToken cancel = new CancellationToken()); 725 726 /// <summary> 727 /// Asynchronously gets the connection for this proxy. 728 /// </summary> 729 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 730 /// <param name="cookie">Application-specific data to be stored in the result.</param> 731 /// <returns>An asynchronous result object.</returns> begin_ice_getConnection(AsyncCallback callback, object cookie)732 AsyncResult begin_ice_getConnection(AsyncCallback callback, object cookie); 733 734 /// <summary> 735 /// Asynchronously gets the connection for this proxy. 736 /// </summary> 737 /// <returns>An asynchronous result object.</returns> begin_ice_getConnection()738 AsyncResult<Callback_Object_ice_getConnection> begin_ice_getConnection(); 739 740 /// <summary> 741 /// Asynchronously gets the connection for this proxy. 742 /// </summary> 743 /// <param name="result">The asynchronous result object returned by <code>begin_ice_getConnection</code>.</param> 744 /// <returns>The connection.</returns> end_ice_getConnection(AsyncResult result)745 Connection end_ice_getConnection(AsyncResult result); 746 747 /// <summary> 748 /// Returns the cached Connection for this proxy. If the proxy does not yet have an established 749 /// connection, it does not attempt to create a connection. 750 /// </summary> 751 /// <returns>The cached Connection for this proxy (null if the proxy does not have 752 /// an established connection).</returns> 753 /// <exception name="CollocationOptimizationException">If the proxy uses collocation optimization and denotes a 754 /// collocated object.</exception> ice_getCachedConnection()755 Connection ice_getCachedConnection(); 756 757 /// <summary> 758 /// Flushes any pending batched requests for this proxy. The call blocks until the flush is complete. 759 /// </summary> ice_flushBatchRequests()760 void ice_flushBatchRequests(); 761 762 /// <summary> 763 /// Asynchronously flushes any pending batched requests for this proxy. 764 /// </summary> 765 /// <param name="progress">Sent progress provider.</param> 766 /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> 767 /// <returns>The task object representing the asynchronous operation.</returns> ice_flushBatchRequestsAsync(IProgress<bool> progress = null, CancellationToken cancel = new CancellationToken())768 Task ice_flushBatchRequestsAsync(IProgress<bool> progress = null, 769 CancellationToken cancel = new CancellationToken()); 770 771 /// <summary> 772 /// Asynchronously flushes any pending batched requests for this proxy. 773 /// </summary> 774 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 775 /// <param name="cookie">Application-specific data to be stored in the result.</param> begin_ice_flushBatchRequests(AsyncCallback callback = null, object cookie = null)776 AsyncResult begin_ice_flushBatchRequests(AsyncCallback callback = null, object cookie = null); 777 778 /// <summary> 779 /// Flushes any pending batched requests for this proxy. The call blocks until the flush is complete. 780 /// </summary> 781 /// <param name="result">The asynchronous result object returned by <code>begin_ice_getConnection</code>.</param> end_ice_flushBatchRequests(AsyncResult result)782 void end_ice_flushBatchRequests(AsyncResult result); 783 784 /// <summary> 785 /// Write a proxy to the output stream. 786 /// </summary> 787 /// <param name="os">Output stream object to write the proxy.</param> 788 [EditorBrowsable(EditorBrowsableState.Never)] iceWrite(OutputStream os)789 void iceWrite(OutputStream os); 790 791 /// <summary> 792 /// Returns a scheduler object that uses the Ice thread pool. 793 /// </summary> 794 /// <returns>The task scheduler object.</returns> ice_scheduler()795 System.Threading.Tasks.TaskScheduler ice_scheduler(); 796 } 797 798 /// <summary> 799 /// Represent the result of the ice_invokeAsync operation 800 /// </summary> 801 public struct Object_Ice_invokeResult 802 { Object_Ice_invokeResultIce.Object_Ice_invokeResult803 public Object_Ice_invokeResult(bool returnValue, byte[] outEncaps) 804 { 805 this.returnValue = returnValue; 806 this.outEncaps = outEncaps; 807 } 808 809 /// <summary> 810 /// If the operation completed successfully, the return value 811 /// is true. If the operation raises a user exception, 812 /// the return value is false; in this case, outEncaps 813 /// contains the encoded user exception. 814 /// </summary> 815 public bool returnValue; 816 817 /// <summary> 818 /// The encoded out-paramaters and return value for the operation. 819 /// The return value follows any out-parameters. If returnValue is 820 /// false it contains the encoded user exception. 821 /// </summary> 822 public byte[] outEncaps; 823 }; 824 825 /// <summary> 826 /// Base class of all object proxies. 827 /// </summary> 828 [Serializable] 829 public class ObjectPrxHelperBase : ObjectPrx, ISerializable 830 { ObjectPrxHelperBase()831 public ObjectPrxHelperBase() 832 { 833 } 834 ObjectPrxHelperBase(SerializationInfo info, StreamingContext context)835 public ObjectPrxHelperBase(SerializationInfo info, StreamingContext context) 836 { 837 Instance instance = null; 838 839 if(context.Context is Communicator) 840 { 841 instance = IceInternal.Util.getInstance(context.Context as Communicator); 842 } 843 else if(context.Context is Instance) 844 { 845 instance = context.Context as Instance; 846 } 847 else 848 { 849 throw new ArgumentException("Cannot deserialize proxy: Ice.Communicator not found in StreamingContext"); 850 } 851 852 var proxy = (ObjectPrxHelperBase)instance.proxyFactory().stringToProxy(info.GetString("proxy")); 853 _reference = proxy._reference; 854 Debug.Assert(proxy._requestHandler == null); 855 } 856 GetObjectData(SerializationInfo info, StreamingContext context)857 public virtual void GetObjectData(SerializationInfo info, StreamingContext context) 858 { 859 info.AddValue("proxy", ToString()); 860 } 861 862 /// <summary> 863 /// Returns a hash code for this proxy. 864 /// </summary> 865 /// <returns>The hash code.</returns> GetHashCode()866 public override int GetHashCode() 867 { 868 return _reference.GetHashCode(); 869 } 870 871 /// <summary> 872 /// Returns the communicator that created this proxy. 873 /// </summary> 874 /// <returns>The communicator that created this proxy.</returns> ice_getCommunicator()875 public Communicator ice_getCommunicator() 876 { 877 return _reference.getCommunicator(); 878 } 879 880 /// <summary> 881 /// Returns the stringified form of this proxy. 882 /// </summary> 883 /// <returns>The stringified proxy.</returns> ToString()884 public override string ToString() 885 { 886 return _reference.ToString(); 887 } 888 889 /// <summary> 890 /// Tests whether this object supports a specific Slice interface. 891 /// </summary> 892 /// <param name="id">The type ID of the Slice interface to test against.</param> 893 /// <param name="context">The context dictionary for the invocation.</param> 894 /// <returns>True if the target object has the interface specified by id or derives 895 /// from the interface specified by id.</returns> ice_isA(string id, OptionalContext context = new OptionalContext())896 public bool ice_isA(string id, OptionalContext context = new OptionalContext()) 897 { 898 try 899 { 900 return iceI_ice_isAAsync(id, context, null, CancellationToken.None, true).Result; 901 } 902 catch(AggregateException ex) 903 { 904 throw ex.InnerException; 905 } 906 } 907 908 /// <summary> 909 /// Tests whether this object supports a specific Slice interface. 910 /// </summary> 911 /// <param name="id">The type ID of the Slice interface to test against.</param> 912 /// <param name="context">The context dictionary for the invocation.</param> 913 /// <param name="progress">Sent progress provider.</param> 914 /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> 915 /// <returns>The task object representing the asynchronous operation.</returns> ice_isAAsync(string id, OptionalContext context = new OptionalContext(), IProgress<bool> progress = null, CancellationToken cancel = new CancellationToken())916 public Task<bool> ice_isAAsync(string id, 917 OptionalContext context = new OptionalContext(), 918 IProgress<bool> progress = null, 919 CancellationToken cancel = new CancellationToken()) 920 { 921 return iceI_ice_isAAsync(id, context, progress, cancel, false); 922 } 923 924 private Task<bool> iceI_ice_isAAsync(string id, OptionalContext context, IProgress<bool> progress, CancellationToken cancel, bool synchronous)925 iceI_ice_isAAsync(string id, OptionalContext context, IProgress<bool> progress, CancellationToken cancel, 926 bool synchronous) 927 { 928 iceCheckTwowayOnly(_ice_isA_name); 929 var completed = new OperationTaskCompletionCallback<bool>(progress, cancel); 930 iceI_ice_isA(id, context, completed, synchronous); 931 return completed.Task; 932 } 933 934 /// <summary> 935 /// Tests whether this object supports a specific Slice interface. 936 /// </summary> 937 /// <param name="id">The type ID of the Slice interface to test against.</param> 938 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 939 /// <param name="cookie">Application-specific data to be stored in the result.</param> 940 /// <returns>An asynchronous result object.</returns> begin_ice_isA(string id, AsyncCallback callback, object cookie)941 public AsyncResult begin_ice_isA(string id, AsyncCallback callback, object cookie) 942 { 943 return iceI_begin_ice_isA(id, new OptionalContext(), callback, cookie, false); 944 } 945 946 /// <summary> 947 /// Tests whether this object supports a specific Slice interface. 948 /// </summary> 949 /// <param name="id">The type ID of the Slice interface to test against.</param> 950 /// <param name="context">The context dictionary for the invocation.</param> 951 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 952 /// <param name="cookie">Application-specific data to be stored in the result.</param> 953 /// <returns>An asynchronous result object.</returns> begin_ice_isA(string id, OptionalContext context, AsyncCallback callback, object cookie)954 public AsyncResult begin_ice_isA(string id, OptionalContext context, AsyncCallback callback, object cookie) 955 { 956 return iceI_begin_ice_isA(id, context, callback, cookie, false); 957 } 958 959 /// <summary> 960 /// Tests whether this object supports a specific Slice interface. 961 /// </summary> 962 /// <param name="id">The type ID of the Slice interface to test against.</param> 963 /// <param name="context">The context dictionary for the invocation.</param> 964 /// <returns>An asynchronous result object.</returns> 965 public AsyncResult<Callback_Object_ice_isA> begin_ice_isA(string id, OptionalContext context = new OptionalContext())966 begin_ice_isA(string id, OptionalContext context = new OptionalContext()) 967 { 968 return iceI_begin_ice_isA(id, context, null, null, false); 969 } 970 971 private const string _ice_isA_name = "ice_isA"; 972 973 /// <summary> 974 /// Tests whether this object supports a specific Slice interface. 975 /// </summary> 976 /// <param name="result">The asynchronous result object returned by <code>begin_ice_isA</code>.</param> 977 /// <returns>True if the object supports the Slice interface, false otherwise.</returns> end_ice_isA(AsyncResult result)978 public bool end_ice_isA(AsyncResult result) 979 { 980 var resultI = AsyncResultI.check(result, this, _ice_isA_name); 981 return ((OutgoingAsyncT<bool>)resultI.OutgoingAsync).getResult(resultI.wait()); 982 } 983 984 private AsyncResult<Callback_Object_ice_isA> iceI_begin_ice_isA(string id, Dictionary<string, string> context, AsyncCallback callback, object cookie, bool synchronous)985 iceI_begin_ice_isA(string id, Dictionary<string, string> context, AsyncCallback callback, object cookie, 986 bool synchronous) 987 { 988 iceCheckAsyncTwowayOnly(_ice_isA_name); 989 var completed = new OperationAsyncResultCompletionCallback<Callback_Object_ice_isA, bool>( 990 (Callback_Object_ice_isA cb, bool result) => 991 { 992 if(cb != null) 993 { 994 cb.Invoke(result); 995 } 996 }, this, _ice_isA_name, cookie, callback); 997 iceI_ice_isA(id, context, completed, synchronous); 998 return completed; 999 } 1000 iceI_ice_isA(string id, Dictionary<string, string> context, OutgoingAsyncCompletionCallback completed, bool synchronous)1001 private void iceI_ice_isA(string id, 1002 Dictionary<string, string> context, 1003 OutgoingAsyncCompletionCallback completed, 1004 bool synchronous) 1005 { 1006 iceCheckAsyncTwowayOnly(_ice_isA_name); 1007 getOutgoingAsync<bool>(completed).invoke(_ice_isA_name, 1008 OperationMode.Nonmutating, 1009 FormatType.DefaultFormat, 1010 context, 1011 synchronous, 1012 (OutputStream os) => { os.writeString(id); }, 1013 null, 1014 (InputStream iss) => { return iss.readBool(); }); 1015 } 1016 1017 /// <summary> 1018 /// Tests whether the target object of this proxy can be reached. 1019 /// </summary> 1020 /// <param name="context">The context dictionary for the invocation.</param> ice_ping(OptionalContext context = new OptionalContext())1021 public void ice_ping(OptionalContext context = new OptionalContext()) 1022 { 1023 try 1024 { 1025 iceI_ice_pingAsync(context, null, CancellationToken.None, true).Wait(); 1026 } 1027 catch(AggregateException ex) 1028 { 1029 throw ex.InnerException; 1030 } 1031 } 1032 1033 /// <summary> 1034 /// Tests whether the target object of this proxy can be reached. 1035 /// </summary> 1036 /// <param name="context">The context dictionary for the invocation.</param> 1037 /// <param name="progress">Sent progress provider.</param> 1038 /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> 1039 /// <returns>The task object representing the asynchronous operation.</returns> ice_pingAsync(OptionalContext context = new OptionalContext(), IProgress<bool> progress = null, CancellationToken cancel = new CancellationToken())1040 public Task ice_pingAsync(OptionalContext context = new OptionalContext(), 1041 IProgress<bool> progress = null, 1042 CancellationToken cancel = new CancellationToken()) 1043 { 1044 return iceI_ice_pingAsync(context, progress, cancel, false); 1045 } 1046 1047 private Task iceI_ice_pingAsync(OptionalContext context, IProgress<bool> progress, CancellationToken cancel, bool synchronous)1048 iceI_ice_pingAsync(OptionalContext context, IProgress<bool> progress, CancellationToken cancel, bool synchronous) 1049 { 1050 var completed = new OperationTaskCompletionCallback<object>(progress, cancel); 1051 iceI_ice_ping(context, completed, synchronous); 1052 return completed.Task; 1053 } 1054 1055 /// <summary> 1056 /// Tests whether the target object of this proxy can be reached. 1057 /// </summary> 1058 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 1059 /// <param name="cookie">Application-specific data to be stored in the result.</param> 1060 /// <returns>An asynchronous result object.</returns> begin_ice_ping(AsyncCallback callback, object cookie)1061 public AsyncResult begin_ice_ping(AsyncCallback callback, object cookie) 1062 { 1063 return iceI_begin_ice_ping(new OptionalContext(), callback, cookie, false); 1064 } 1065 1066 /// <summary> 1067 /// Tests whether the target object of this proxy can be reached. 1068 /// </summary> 1069 /// <param name="context">The context dictionary for the invocation.</param> 1070 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 1071 /// <param name="cookie">Application-specific data to be stored in the result.</param> 1072 /// <returns>An asynchronous result object.</returns> begin_ice_ping(OptionalContext context, AsyncCallback callback, object cookie)1073 public AsyncResult begin_ice_ping(OptionalContext context, AsyncCallback callback, object cookie) 1074 { 1075 return iceI_begin_ice_ping(context, callback, cookie, false); 1076 } 1077 1078 /// <summary> 1079 /// Tests whether the target object of this proxy can be reached. 1080 /// </summary> 1081 /// <param name="context">The context dictionary for the invocation.</param> 1082 /// <returns>An asynchronous result object.</returns> 1083 public AsyncResult<Callback_Object_ice_ping> begin_ice_ping(OptionalContext context = new OptionalContext())1084 begin_ice_ping(OptionalContext context = new OptionalContext()) 1085 { 1086 return iceI_begin_ice_ping(context, null, null, false); 1087 } 1088 1089 private const string _ice_ping_name = "ice_ping"; 1090 1091 /// <summary> 1092 /// Tests whether the target object of this proxy can be reached. 1093 /// </summary> 1094 /// <param name="result">The asynchronous result object returned by <code>begin_ice_ping</code>.</param> end_ice_ping(AsyncResult result)1095 public void end_ice_ping(AsyncResult result) 1096 { 1097 var resultI = AsyncResultI.check(result, this, _ice_ping_name); 1098 ((OutgoingAsyncT<object>)resultI.OutgoingAsync).getResult(resultI.wait()); 1099 } 1100 iceI_begin_ice_ping(Dictionary<string, string> context, AsyncCallback callback, object cookie, bool synchronous)1101 private AsyncResult<Callback_Object_ice_ping> iceI_begin_ice_ping(Dictionary<string, string> context, 1102 AsyncCallback callback, 1103 object cookie, 1104 bool synchronous) 1105 { 1106 var completed = new OperationAsyncResultCompletionCallback<Callback_Object_ice_ping, object>( 1107 (Callback_Object_ice_ping cb, object result) => 1108 { 1109 if(cb != null) 1110 { 1111 cb.Invoke(); 1112 } 1113 }, this, _ice_ping_name, cookie, callback); 1114 iceI_ice_ping(context, completed, synchronous); 1115 return completed; 1116 } 1117 iceI_ice_ping(Dictionary<string, string> context, OutgoingAsyncCompletionCallback completed, bool synchronous)1118 private void iceI_ice_ping(Dictionary<string, string> context, OutgoingAsyncCompletionCallback completed, 1119 bool synchronous) 1120 { 1121 getOutgoingAsync<object>(completed).invoke(_ice_ping_name, 1122 OperationMode.Nonmutating, 1123 FormatType.DefaultFormat, 1124 context, 1125 synchronous); 1126 } 1127 1128 /// <summary> 1129 /// Returns the Slice type IDs of the interfaces supported by the target object of this proxy. 1130 /// </summary> 1131 /// <param name="context">The context dictionary for the invocation.</param> 1132 /// <returns>The Slice type IDs of the interfaces supported by the target object, in base-to-derived 1133 /// order. The first element of the returned array is always ::Ice::Object.</returns> ice_ids(OptionalContext context = new OptionalContext())1134 public string[] ice_ids(OptionalContext context = new OptionalContext()) 1135 { 1136 try 1137 { 1138 return iceI_ice_idsAsync(context, null, CancellationToken.None, true).Result; 1139 } 1140 catch(AggregateException ex) 1141 { 1142 throw ex.InnerException; 1143 } 1144 } 1145 1146 /// <summary> 1147 /// Returns the Slice type IDs of the interfaces supported by the target object of this proxy. 1148 /// </summary> 1149 /// <param name="context">The context dictionary for the invocation.</param> 1150 /// <param name="progress">Sent progress provider.</param> 1151 /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> 1152 /// <returns>The task object representing the asynchronous operation.</returns> 1153 public Task<string[]> ice_idsAsync(OptionalContext context = new OptionalContext(), IProgress<bool> progress = null, CancellationToken cancel = new CancellationToken())1154 ice_idsAsync(OptionalContext context = new OptionalContext(), 1155 IProgress<bool> progress = null, 1156 CancellationToken cancel = new CancellationToken()) 1157 { 1158 return iceI_ice_idsAsync(context, progress, cancel, false); 1159 } 1160 iceI_ice_idsAsync(OptionalContext context, IProgress<bool> progress, CancellationToken cancel, bool synchronous)1161 private Task<string[]> iceI_ice_idsAsync(OptionalContext context, IProgress<bool> progress, CancellationToken cancel, 1162 bool synchronous) 1163 { 1164 iceCheckTwowayOnly(_ice_ids_name); 1165 var completed = new OperationTaskCompletionCallback<string[]>(progress, cancel); 1166 iceI_ice_ids(context, completed, false); 1167 return completed.Task; 1168 } 1169 1170 /// <summary> 1171 /// Returns the Slice type IDs of the interfaces supported by the target object of this proxy. 1172 /// </summary> 1173 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 1174 /// <param name="cookie">Application-specific data to be stored in the result.</param> 1175 /// <returns>An asynchronous result object.</returns> begin_ice_ids(AsyncCallback callback, object cookie)1176 public AsyncResult begin_ice_ids(AsyncCallback callback, object cookie) 1177 { 1178 return iceI_begin_ice_ids(new OptionalContext(), callback, cookie, false); 1179 } 1180 1181 /// <summary> 1182 /// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. 1183 /// </summary> 1184 /// <param name="context">The context dictionary for the invocation.</param> 1185 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 1186 /// <param name="cookie">Application-specific data to be stored in the result.</param> 1187 /// <returns>An asynchronous result object.</returns> 1188 public AsyncResult begin_ice_ids(OptionalContext context, AsyncCallback callback, object cookie)1189 begin_ice_ids(OptionalContext context, AsyncCallback callback, object cookie) 1190 { 1191 return iceI_begin_ice_ids(context, callback, cookie, false); 1192 } 1193 1194 public AsyncResult<Callback_Object_ice_ids> begin_ice_ids(OptionalContext context = new OptionalContext())1195 begin_ice_ids(OptionalContext context = new OptionalContext()) 1196 { 1197 return iceI_begin_ice_ids(context, null, null, false); 1198 } 1199 1200 private const string _ice_ids_name = "ice_ids"; 1201 1202 private AsyncResult<Callback_Object_ice_ids> iceI_begin_ice_ids(Dictionary<string, string> context, AsyncCallback callback, object cookie, bool synchronous)1203 iceI_begin_ice_ids(Dictionary<string, string> context, AsyncCallback callback, object cookie, bool synchronous) 1204 { 1205 iceCheckAsyncTwowayOnly(_ice_ids_name); 1206 var completed = new OperationAsyncResultCompletionCallback<Callback_Object_ice_ids, string[]>( 1207 (Callback_Object_ice_ids cb, string[] result) => 1208 { 1209 if(cb != null) 1210 { 1211 cb.Invoke(result); 1212 } 1213 }, this, _ice_ids_name, cookie, callback); 1214 iceI_ice_ids(context, completed, synchronous); 1215 return completed; 1216 } 1217 1218 /// <summary> 1219 /// Returns the Slice type IDs of the interfaces supported by the target object of this proxy. 1220 /// </summary> 1221 /// <param name="result">The asynchronous result object returned by <code>begin_ice_ids</code>.</param> 1222 /// <returns>The Slice type IDs of the interfaces supported by the target object, in base-to-derived 1223 /// order. The first element of the returned array is always ::Ice::Object.</returns> end_ice_ids(AsyncResult result)1224 public string[] end_ice_ids(AsyncResult result) 1225 { 1226 var resultI = AsyncResultI.check(result, this, _ice_ids_name); 1227 return ((OutgoingAsyncT<string[]>)resultI.OutgoingAsync).getResult(resultI.wait()); 1228 } 1229 iceI_ice_ids(Dictionary<string, string> context, OutgoingAsyncCompletionCallback completed, bool synchronous)1230 private void iceI_ice_ids(Dictionary<string, string> context, OutgoingAsyncCompletionCallback completed, 1231 bool synchronous) 1232 { 1233 iceCheckAsyncTwowayOnly(_ice_ids_name); 1234 getOutgoingAsync<string[]>(completed).invoke(_ice_ids_name, 1235 OperationMode.Nonmutating, 1236 FormatType.DefaultFormat, 1237 context, 1238 synchronous, 1239 read: (InputStream iss) => { return iss.readStringSeq(); }); 1240 } 1241 1242 /// <summary> 1243 /// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. 1244 /// </summary> 1245 /// <returns>The Slice type ID of the most-derived interface.</returns> ice_id(OptionalContext context = new OptionalContext())1246 public string ice_id(OptionalContext context = new OptionalContext()) 1247 { 1248 try 1249 { 1250 return iceI_ice_idAsync(context, null, CancellationToken.None, true).Result; 1251 } 1252 catch(AggregateException ex) 1253 { 1254 throw ex.InnerException; 1255 } 1256 } 1257 1258 /// <summary> 1259 /// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. 1260 /// </summary> 1261 /// <param name="context">The context dictionary for the invocation.</param> 1262 /// <param name="progress">Sent progress provider.</param> 1263 /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> 1264 /// <returns>The task object representing the asynchronous operation.</returns> ice_idAsync(OptionalContext context = new OptionalContext(), IProgress<bool> progress = null, CancellationToken cancel = new CancellationToken())1265 public Task<string> ice_idAsync(OptionalContext context = new OptionalContext(), 1266 IProgress<bool> progress = null, 1267 CancellationToken cancel = new CancellationToken()) 1268 { 1269 return iceI_ice_idAsync(context, progress, cancel, false); 1270 } 1271 1272 private Task<string> iceI_ice_idAsync(OptionalContext context, IProgress<bool> progress, CancellationToken cancel, bool synchronous)1273 iceI_ice_idAsync(OptionalContext context, IProgress<bool> progress, CancellationToken cancel, bool synchronous) 1274 { 1275 iceCheckTwowayOnly(_ice_id_name); 1276 var completed = new OperationTaskCompletionCallback<string>(progress, cancel); 1277 iceI_ice_id(context, completed, synchronous); 1278 return completed.Task; 1279 } 1280 1281 /// <summary> 1282 /// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. 1283 /// </summary> 1284 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 1285 /// <param name="cookie">Application-specific data to be stored in the result.</param> 1286 /// <returns>An asynchronous result object.</returns> begin_ice_id(AsyncCallback callback, object cookie)1287 public AsyncResult begin_ice_id(AsyncCallback callback, object cookie) 1288 { 1289 return iceI_begin_ice_id(new OptionalContext(), callback, cookie, false); 1290 } 1291 1292 /// <summary> 1293 /// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. 1294 /// </summary> 1295 /// <param name="context">The context dictionary for the invocation.</param> 1296 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 1297 /// <param name="cookie">Application-specific data to be stored in the result.</param> 1298 /// <returns>An asynchronous result object.</returns> 1299 public AsyncResult begin_ice_id(OptionalContext context, AsyncCallback callback, object cookie)1300 begin_ice_id(OptionalContext context, AsyncCallback callback, object cookie) 1301 { 1302 return iceI_begin_ice_id(context, callback, cookie, false); 1303 } 1304 1305 /// <summary> 1306 /// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. 1307 /// </summary> 1308 /// <param name="context">The context dictionary for the invocation.</param> 1309 /// <returns>An asynchronous result object.</returns> 1310 public AsyncResult<Callback_Object_ice_id> begin_ice_id(OptionalContext context = new OptionalContext())1311 begin_ice_id(OptionalContext context = new OptionalContext()) 1312 { 1313 return iceI_begin_ice_id(context, null, null, false); 1314 } 1315 1316 private const string _ice_id_name = "ice_id"; 1317 1318 private AsyncResult<Callback_Object_ice_id> iceI_begin_ice_id(Dictionary<string, string> context, AsyncCallback callback, object cookie, bool synchronous)1319 iceI_begin_ice_id(Dictionary<string, string> context, AsyncCallback callback, object cookie, bool synchronous) 1320 { 1321 iceCheckAsyncTwowayOnly(_ice_id_name); 1322 var completed = new OperationAsyncResultCompletionCallback<Callback_Object_ice_id, string>( 1323 (Callback_Object_ice_id cb, string result) => 1324 { 1325 if(cb != null) 1326 { 1327 cb.Invoke(result); 1328 } 1329 }, this, _ice_id_name, cookie, callback); 1330 iceI_ice_id(context, completed, synchronous); 1331 return completed; 1332 } 1333 1334 /// <summary> 1335 /// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. 1336 /// </summary> 1337 /// <param name="result">The asynchronous result object returned by <code>begin_ice_id</code>.</param> 1338 /// <returns>The Slice type ID of the most-derived interface.</returns> end_ice_id(AsyncResult result)1339 public string end_ice_id(AsyncResult result) 1340 { 1341 var resultI = AsyncResultI.check(result, this, _ice_id_name); 1342 return ((OutgoingAsyncT<string>)resultI.OutgoingAsync).getResult(resultI.wait()); 1343 } 1344 iceI_ice_id(Dictionary<string, string> context, OutgoingAsyncCompletionCallback completed, bool synchronous)1345 private void iceI_ice_id(Dictionary<string, string> context, 1346 OutgoingAsyncCompletionCallback completed, 1347 bool synchronous) 1348 { 1349 getOutgoingAsync<string>(completed).invoke(_ice_id_name, 1350 OperationMode.Nonmutating, 1351 FormatType.DefaultFormat, 1352 context, 1353 synchronous, 1354 read: (InputStream iss) => { return iss.readString(); }); 1355 } 1356 1357 /// <summary> 1358 /// Invokes an operation dynamically. 1359 /// </summary> 1360 /// <param name="operation">The name of the operation to invoke.</param> 1361 /// <param name="mode">The operation mode (normal or idempotent).</param> 1362 /// <param name="inEncaps">The encoded in-parameters for the operation.</param> 1363 /// <param name="outEncaps">The encoded out-paramaters and return value 1364 /// for the operation. The return value follows any out-parameters.</param> 1365 /// <param name="context">The context dictionary for the invocation.</param> 1366 /// <returns>If the operation completed successfully, the return value 1367 /// is true. If the operation raises a user exception, 1368 /// the return value is false; in this case, outEncaps 1369 /// contains the encoded user exception. If the operation raises a run-time exception, 1370 /// it throws it directly.</returns> ice_invoke(string operation, OperationMode mode, byte[] inEncaps, out byte[] outEncaps, OptionalContext context = new OptionalContext())1371 public bool ice_invoke(string operation, 1372 OperationMode mode, 1373 byte[] inEncaps, 1374 out byte[] outEncaps, 1375 OptionalContext context = new OptionalContext()) 1376 { 1377 try 1378 { 1379 var result = iceI_ice_invokeAsync(operation, mode, inEncaps, context, null, CancellationToken.None, true).Result; 1380 outEncaps = result.outEncaps; 1381 return result.returnValue; 1382 } 1383 catch(AggregateException ex) 1384 { 1385 throw ex.InnerException; 1386 } 1387 } 1388 1389 /// <summary> 1390 /// Invokes an operation dynamically. 1391 /// </summary> 1392 /// <param name="operation">The name of the operation to invoke.</param> 1393 /// <param name="mode">The operation mode (normal or idempotent).</param> 1394 /// <param name="inEncaps">The encoded in-parameters for the operation.</param> 1395 /// <param name="context">The context dictionary for the invocation.</param> 1396 /// <param name="progress">Sent progress provider.</param> 1397 /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> 1398 /// <returns>The task object representing the asynchronous operation.</returns> 1399 public Task<Object_Ice_invokeResult> ice_invokeAsync(string operation, OperationMode mode, byte[] inEncaps, OptionalContext context = new OptionalContext(), IProgress<bool> progress = null, CancellationToken cancel = new CancellationToken())1400 ice_invokeAsync(string operation, 1401 OperationMode mode, 1402 byte[] inEncaps, 1403 OptionalContext context = new OptionalContext(), 1404 IProgress<bool> progress = null, 1405 CancellationToken cancel = new CancellationToken()) 1406 { 1407 return iceI_ice_invokeAsync(operation, mode, inEncaps, context, progress, cancel, false); 1408 } 1409 1410 private Task<Object_Ice_invokeResult> iceI_ice_invokeAsync(string operation, OperationMode mode, byte[] inEncaps, OptionalContext context, IProgress<bool> progress, CancellationToken cancel, bool synchronous)1411 iceI_ice_invokeAsync(string operation, 1412 OperationMode mode, 1413 byte[] inEncaps, 1414 OptionalContext context, 1415 IProgress<bool> progress, 1416 CancellationToken cancel, 1417 bool synchronous) 1418 { 1419 var completed = new InvokeTaskCompletionCallback(progress, cancel); 1420 iceI_ice_invoke(operation, mode, inEncaps, context, completed, synchronous); 1421 return completed.Task; 1422 } 1423 1424 /// <summary> 1425 /// Invokes an operation dynamically. 1426 /// </summary> 1427 /// <param name="operation">The name of the operation to invoke.</param> 1428 /// <param name="mode">The operation mode (normal or idempotent).</param> 1429 /// <param name="inEncaps">The encoded in-parameters for the operation.</param> 1430 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 1431 /// <param name="cookie">Application-specific data to be stored in the result.</param> 1432 /// <returns>An asynchronous result object.</returns> 1433 public AsyncResult begin_ice_invoke(string operation, OperationMode mode, byte[] inEncaps, AsyncCallback callback, object cookie)1434 begin_ice_invoke(string operation, 1435 OperationMode mode, 1436 byte[] inEncaps, 1437 AsyncCallback callback, 1438 object cookie) 1439 { 1440 return iceI_begin_ice_invoke(operation, mode, inEncaps, new OptionalContext(), callback, cookie, false); 1441 } 1442 1443 /// <summary> 1444 /// Invokes an operation dynamically. 1445 /// </summary> 1446 /// <param name="operation">The name of the operation to invoke.</param> 1447 /// <param name="mode">The operation mode (normal or idempotent).</param> 1448 /// <param name="inEncaps">The encoded in-parameters for the operation.</param> 1449 /// <param name="context">The context dictionary for the invocation.</param> 1450 /// <param name="callback">A callback to be invoked when the invocation completes.</param> 1451 /// <param name="cookie">Application-specific data to be stored in the result.</param> 1452 /// <returns>An asynchronous result object.</returns> 1453 public AsyncResult begin_ice_invoke(string operation, OperationMode mode, byte[] inEncaps, OptionalContext context, AsyncCallback callback, object cookie)1454 begin_ice_invoke(string operation, 1455 OperationMode mode, 1456 byte[] inEncaps, 1457 OptionalContext context, 1458 AsyncCallback callback, 1459 object cookie) 1460 { 1461 return iceI_begin_ice_invoke(operation, mode, inEncaps, context, callback, cookie, false); 1462 } 1463 1464 /// <summary> 1465 /// Invokes an operation dynamically. 1466 /// </summary> 1467 /// <param name="operation">The name of the operation to invoke.</param> 1468 /// <param name="mode">The operation mode (normal or idempotent).</param> 1469 /// <param name="inEncaps">The encoded in-parameters for the operation.</param> 1470 /// <param name="context">The context dictionary for the invocation.</param> 1471 /// <returns>An asynchronous result object.</returns> 1472 public AsyncResult<Callback_Object_ice_invoke> begin_ice_invoke(string operation, OperationMode mode, byte[] inEncaps, OptionalContext context = new OptionalContext())1473 begin_ice_invoke(string operation, 1474 OperationMode mode, 1475 byte[] inEncaps, 1476 OptionalContext context = new OptionalContext()) 1477 { 1478 return iceI_begin_ice_invoke(operation, mode, inEncaps, context, null, null, false); 1479 } 1480 1481 private const string _ice_invoke_name = "ice_invoke"; 1482 1483 /// <summary> 1484 /// Completes a dynamic invocation. 1485 /// </summary> 1486 /// <param name="outEncaps">The encoded out parameters or user exception.</param> 1487 /// <param name="result">The asynchronous result object returned by <code>begin_ice_invoke</code>.</param> 1488 /// <returns>If the operation completed successfully, the return value 1489 /// is true. If the operation raises a user exception, 1490 /// the return value is false; in this case, outEncaps 1491 /// contains the encoded user exception. If the operation raises a run-time exception, 1492 /// it throws it directly.</returns> end_ice_invoke(out byte[] outEncaps, AsyncResult result)1493 public bool end_ice_invoke(out byte[] outEncaps, AsyncResult result) 1494 { 1495 var resultI = AsyncResultI.check(result, this, _ice_invoke_name); 1496 var r = ((InvokeOutgoingAsyncT)resultI.OutgoingAsync).getResult(resultI.wait()); 1497 outEncaps = r.outEncaps; 1498 return r.returnValue; 1499 } 1500 1501 private AsyncResult<Callback_Object_ice_invoke> iceI_begin_ice_invoke(string operation, OperationMode mode, byte[] inEncaps, Dictionary<string, string> context, AsyncCallback callback, object cookie, bool synchronous)1502 iceI_begin_ice_invoke(string operation, 1503 OperationMode mode, 1504 byte[] inEncaps, 1505 Dictionary<string, string> context, 1506 AsyncCallback callback, 1507 object cookie, 1508 bool synchronous) 1509 { 1510 var completed = new InvokeAsyncResultCompletionCallback(this, _ice_invoke_name, cookie, callback); 1511 iceI_ice_invoke(operation, mode, inEncaps, context, completed, synchronous); 1512 return completed; 1513 } 1514 iceI_ice_invoke(string operation, OperationMode mode, byte[] inEncaps, Dictionary<string, string> context, OutgoingAsyncCompletionCallback completed, bool synchronous)1515 private void iceI_ice_invoke(string operation, 1516 OperationMode mode, 1517 byte[] inEncaps, 1518 Dictionary<string, string> context, 1519 OutgoingAsyncCompletionCallback completed, 1520 bool synchronous) 1521 { 1522 getInvokeOutgoingAsync(completed).invoke(operation, mode, inEncaps, context, synchronous); 1523 } 1524 1525 /// <summary> 1526 /// Returns the identity embedded in this proxy. 1527 /// <returns>The identity of the target object.</returns> 1528 /// </summary> ice_getIdentity()1529 public Identity ice_getIdentity() 1530 { 1531 return (Identity)_reference.getIdentity().Clone(); 1532 } 1533 1534 /// <summary> 1535 /// Creates a new proxy that is identical to this proxy, except for the per-proxy context. 1536 /// <param name="newIdentity">The identity for the new proxy.</param> 1537 /// <returns>The proxy with the new identity.</returns> 1538 /// </summary> ice_identity(Identity newIdentity)1539 public ObjectPrx ice_identity(Identity newIdentity) 1540 { 1541 if(newIdentity.name.Length == 0) 1542 { 1543 throw new IllegalIdentityException(); 1544 } 1545 if(newIdentity.Equals(_reference.getIdentity())) 1546 { 1547 return this; 1548 } 1549 else 1550 { 1551 var proxy = new ObjectPrxHelperBase(); 1552 proxy.setup(_reference.changeIdentity(newIdentity)); 1553 return proxy; 1554 } 1555 } 1556 1557 /// <summary> 1558 /// Returns the per-proxy context for this proxy. 1559 /// </summary> 1560 /// <returns>The per-proxy context. If the proxy does not have a per-proxy (implicit) context, the return value 1561 /// is null.</returns> ice_getContext()1562 public Dictionary<string, string> ice_getContext() 1563 { 1564 return new Dictionary<string, string>(_reference.getContext()); 1565 } 1566 1567 /// <summary> 1568 /// Creates a new proxy that is identical to this proxy, except for the per-proxy context. 1569 /// </summary> 1570 /// <param name="newContext">The context for the new proxy.</param> 1571 /// <returns>The proxy with the new per-proxy context.</returns> ice_context(Dictionary<string, string> newContext)1572 public ObjectPrx ice_context(Dictionary<string, string> newContext) 1573 { 1574 return newInstance(_reference.changeContext(newContext)); 1575 } 1576 1577 /// <summary> 1578 /// Returns the facet for this proxy. 1579 /// </summary> 1580 /// <returns>The facet for this proxy. If the proxy uses the default facet, the return value is the 1581 /// empty string.</returns> ice_getFacet()1582 public string ice_getFacet() 1583 { 1584 return _reference.getFacet(); 1585 } 1586 1587 /// <summary> 1588 /// Creates a new proxy that is identical to this proxy, except for the facet. 1589 /// </summary> 1590 /// <param name="newFacet">The facet for the new proxy.</param> 1591 /// <returns>The proxy with the new facet.</returns> ice_facet(string newFacet)1592 public ObjectPrx ice_facet(string newFacet) 1593 { 1594 if(newFacet == null) 1595 { 1596 newFacet = ""; 1597 } 1598 1599 if(newFacet.Equals(_reference.getFacet())) 1600 { 1601 return this; 1602 } 1603 else 1604 { 1605 var proxy = new ObjectPrxHelperBase(); 1606 proxy.setup(_reference.changeFacet(newFacet)); 1607 return proxy; 1608 } 1609 } 1610 1611 /// <summary> 1612 /// Returns the adapter ID for this proxy. 1613 /// </summary> 1614 /// <returns>The adapter ID. If the proxy does not have an adapter ID, the return value is the 1615 /// empty string.</returns> ice_getAdapterId()1616 public string ice_getAdapterId() 1617 { 1618 return _reference.getAdapterId(); 1619 } 1620 1621 /// <summary> 1622 /// Creates a new proxy that is identical to this proxy, except for the adapter ID. 1623 /// </summary> 1624 /// <param name="newAdapterId">The adapter ID for the new proxy.</param> 1625 /// <returns>The proxy with the new adapter ID.</returns> ice_adapterId(string newAdapterId)1626 public ObjectPrx ice_adapterId(string newAdapterId) 1627 { 1628 if(newAdapterId == null) 1629 { 1630 newAdapterId = ""; 1631 } 1632 1633 if(newAdapterId.Equals(_reference.getAdapterId())) 1634 { 1635 return this; 1636 } 1637 else 1638 { 1639 return newInstance(_reference.changeAdapterId(newAdapterId)); 1640 } 1641 } 1642 1643 /// <summary> 1644 /// Returns the endpoints used by this proxy. 1645 /// </summary> 1646 /// <returns>The endpoints used by this proxy.</returns> ice_getEndpoints()1647 public Endpoint[] ice_getEndpoints() 1648 { 1649 return (Endpoint[])_reference.getEndpoints().Clone(); 1650 } 1651 1652 /// <summary> 1653 /// Creates a new proxy that is identical to this proxy, except for the endpoints. 1654 /// </summary> 1655 /// <param name="newEndpoints">The endpoints for the new proxy.</param> 1656 /// <returns>The proxy with the new endpoints.</returns> ice_endpoints(Endpoint[] newEndpoints)1657 public ObjectPrx ice_endpoints(Endpoint[] newEndpoints) 1658 { 1659 if(Arrays.Equals(newEndpoints, _reference.getEndpoints())) 1660 { 1661 return this; 1662 } 1663 else 1664 { 1665 var endpts = new EndpointI[newEndpoints.Length]; 1666 for(int i = 0; i < newEndpoints.Length; ++i) 1667 { 1668 endpts[i] = (EndpointI)newEndpoints[i]; 1669 } 1670 return newInstance(_reference.changeEndpoints(endpts)); 1671 } 1672 } 1673 1674 /// <summary> 1675 /// Returns the locator cache timeout of this proxy. 1676 /// </summary> 1677 /// <returns>The locator cache timeout value (in seconds).</returns> ice_getLocatorCacheTimeout()1678 public int ice_getLocatorCacheTimeout() 1679 { 1680 return _reference.getLocatorCacheTimeout(); 1681 } 1682 1683 /// <summary> 1684 /// Creates a new proxy that is identical to this proxy, except for the locator cache timeout. 1685 /// </summary> 1686 /// <param name="newTimeout">The new locator cache timeout (in seconds).</param> ice_locatorCacheTimeout(int newTimeout)1687 public ObjectPrx ice_locatorCacheTimeout(int newTimeout) 1688 { 1689 if(newTimeout < -1) 1690 { 1691 throw new ArgumentException("invalid value passed to ice_locatorCacheTimeout: " + newTimeout); 1692 } 1693 if(newTimeout == _reference.getLocatorCacheTimeout()) 1694 { 1695 return this; 1696 } 1697 else 1698 { 1699 return newInstance(_reference.changeLocatorCacheTimeout(newTimeout)); 1700 } 1701 } 1702 1703 /// <summary> 1704 /// Returns the invocation timeout of this proxy. 1705 /// </summary> 1706 /// <returns>The invocation timeout value (in seconds).</returns> ice_getInvocationTimeout()1707 public int ice_getInvocationTimeout() 1708 { 1709 return _reference.getInvocationTimeout(); 1710 } 1711 1712 /// <summary> 1713 /// Creates a new proxy that is identical to this proxy, except for the invocation timeout. 1714 /// </summary> 1715 /// <param name="newTimeout">The new invocation timeout (in seconds).</param> ice_invocationTimeout(int newTimeout)1716 public ObjectPrx ice_invocationTimeout(int newTimeout) 1717 { 1718 if(newTimeout < 1 && newTimeout != -1 && newTimeout != -2) 1719 { 1720 throw new ArgumentException("invalid value passed to ice_invocationTimeout: " + newTimeout); 1721 } 1722 if(newTimeout == _reference.getInvocationTimeout()) 1723 { 1724 return this; 1725 } 1726 else 1727 { 1728 return newInstance(_reference.changeInvocationTimeout(newTimeout)); 1729 } 1730 } 1731 1732 /// <summary> 1733 /// Returns whether this proxy caches connections. 1734 /// </summary> 1735 /// <returns>True if this proxy caches connections; false, otherwise.</returns> ice_isConnectionCached()1736 public bool ice_isConnectionCached() 1737 { 1738 return _reference.getCacheConnection(); 1739 } 1740 1741 /// <summary> 1742 /// Creates a new proxy that is identical to this proxy, except for connection caching. 1743 /// </summary> 1744 /// <param name="newCache">True if the new proxy should cache connections; false, otherwise.</param> 1745 /// <returns>The new proxy with the specified caching policy.</returns> ice_connectionCached(bool newCache)1746 public ObjectPrx ice_connectionCached(bool newCache) 1747 { 1748 if(newCache == _reference.getCacheConnection()) 1749 { 1750 return this; 1751 } 1752 else 1753 { 1754 return newInstance(_reference.changeCacheConnection(newCache)); 1755 } 1756 } 1757 1758 /// <summary> 1759 /// Returns how this proxy selects endpoints (randomly or ordered). 1760 /// </summary> 1761 /// <returns>The endpoint selection policy.</returns> ice_getEndpointSelection()1762 public EndpointSelectionType ice_getEndpointSelection() 1763 { 1764 return _reference.getEndpointSelection(); 1765 } 1766 1767 /// <summary> 1768 /// Creates a new proxy that is identical to this proxy, except for the endpoint selection policy. 1769 /// </summary> 1770 /// <param name="newType">The new endpoint selection policy.</param> 1771 /// <returns>The new proxy with the specified endpoint selection policy.</returns> ice_endpointSelection(EndpointSelectionType newType)1772 public ObjectPrx ice_endpointSelection(EndpointSelectionType newType) 1773 { 1774 if(newType == _reference.getEndpointSelection()) 1775 { 1776 return this; 1777 } 1778 else 1779 { 1780 return newInstance(_reference.changeEndpointSelection(newType)); 1781 } 1782 } 1783 1784 /// <summary> 1785 /// Returns whether this proxy communicates only via secure endpoints. 1786 /// </summary> 1787 /// <returns>True if this proxy communicates only vi secure endpoints; false, otherwise.</returns> ice_isSecure()1788 public bool ice_isSecure() 1789 { 1790 return _reference.getSecure(); 1791 } 1792 1793 /// <summary> 1794 /// Creates a new proxy that is identical to this proxy, except for how it selects endpoints. 1795 /// </summary> 1796 /// <param name="b"> If b is true, only endpoints that use a secure transport are 1797 /// used by the new proxy. If b is false, the returned proxy uses both secure and insecure 1798 /// endpoints.</param> 1799 /// <returns>The new proxy with the specified selection policy.</returns> ice_secure(bool b)1800 public ObjectPrx ice_secure(bool b) 1801 { 1802 if(b == _reference.getSecure()) 1803 { 1804 return this; 1805 } 1806 else 1807 { 1808 return newInstance(_reference.changeSecure(b)); 1809 } 1810 } 1811 1812 /// <summary> 1813 /// Creates a new proxy that is identical to this proxy, except for the encoding used to marshal 1814 /// parameters. 1815 /// </summary> 1816 /// <param name="e">The encoding version to use to marshal requests parameters.</param> 1817 /// <returns>The new proxy with the specified encoding version.</returns> ice_encodingVersion(EncodingVersion e)1818 public ObjectPrx ice_encodingVersion(EncodingVersion e) 1819 { 1820 if(e.Equals(_reference.getEncoding())) 1821 { 1822 return this; 1823 } 1824 else 1825 { 1826 return newInstance(_reference.changeEncoding(e)); 1827 } 1828 } 1829 1830 /// <summary>Returns the encoding version used to marshal requests parameters.</summary> 1831 /// <returns>The encoding version.</returns> ice_getEncodingVersion()1832 public EncodingVersion ice_getEncodingVersion() 1833 { 1834 return _reference.getEncoding(); 1835 } 1836 1837 /// <summary> 1838 /// Returns whether this proxy prefers secure endpoints. 1839 /// </summary> 1840 /// <returns>True if the proxy always attempts to invoke via secure endpoints before it 1841 /// attempts to use insecure endpoints; false, otherwise.</returns> ice_isPreferSecure()1842 public bool ice_isPreferSecure() 1843 { 1844 return _reference.getPreferSecure(); 1845 } 1846 1847 /// <summary> 1848 /// Creates a new proxy that is identical to this proxy, except for its endpoint selection policy. 1849 /// </summary> 1850 /// <param name="b">If b is true, the new proxy will use secure endpoints for invocations 1851 /// and only use insecure endpoints if an invocation cannot be made via secure endpoints. If b is 1852 /// false, the proxy prefers insecure endpoints to secure ones.</param> 1853 /// <returns>The new proxy with the new endpoint selection policy.</returns> ice_preferSecure(bool b)1854 public ObjectPrx ice_preferSecure(bool b) 1855 { 1856 if(b == _reference.getPreferSecure()) 1857 { 1858 return this; 1859 } 1860 else 1861 { 1862 return newInstance(_reference.changePreferSecure(b)); 1863 } 1864 } 1865 1866 /// <summary> 1867 /// Returns the router for this proxy. 1868 /// </summary> 1869 /// <returns>The router for the proxy. If no router is configured for the proxy, the return value 1870 /// is null.</returns> ice_getRouter()1871 public RouterPrx ice_getRouter() 1872 { 1873 RouterInfo ri = _reference.getRouterInfo(); 1874 return ri != null ? ri.getRouter() : null; 1875 } 1876 1877 /// <summary> 1878 /// Creates a new proxy that is identical to this proxy, except for the router. 1879 /// </summary> 1880 /// <param name="router">The router for the new proxy.</param> 1881 /// <returns>The new proxy with the specified router.</returns> ice_router(RouterPrx router)1882 public ObjectPrx ice_router(RouterPrx router) 1883 { 1884 Reference @ref = _reference.changeRouter(router); 1885 if(@ref.Equals(_reference)) 1886 { 1887 return this; 1888 } 1889 else 1890 { 1891 return newInstance(@ref); 1892 } 1893 } 1894 1895 /// <summary> 1896 /// Returns the locator for this proxy. 1897 /// </summary> 1898 /// <returns>The locator for this proxy. If no locator is configured, the return value is null.</returns> ice_getLocator()1899 public LocatorPrx ice_getLocator() 1900 { 1901 var li = _reference.getLocatorInfo(); 1902 return li != null ? li.getLocator() : null; 1903 } 1904 1905 /// <summary> 1906 /// Creates a new proxy that is identical to this proxy, except for the locator. 1907 /// </summary> 1908 /// <param name="locator">The locator for the new proxy.</param> 1909 /// <returns>The new proxy with the specified locator.</returns> ice_locator(LocatorPrx locator)1910 public ObjectPrx ice_locator(LocatorPrx locator) 1911 { 1912 var @ref = _reference.changeLocator(locator); 1913 if(@ref.Equals(_reference)) 1914 { 1915 return this; 1916 } 1917 else 1918 { 1919 return newInstance(@ref); 1920 } 1921 } 1922 1923 /// <summary> 1924 /// Returns whether this proxy uses collocation optimization. 1925 /// </summary> 1926 /// <returns>True if the proxy uses collocation optimization; false, otherwise.</returns> ice_isCollocationOptimized()1927 public bool ice_isCollocationOptimized() 1928 { 1929 return _reference.getCollocationOptimized(); 1930 } 1931 1932 /// <summary> 1933 /// Creates a new proxy that is identical to this proxy, except for collocation optimization. 1934 /// </summary> 1935 /// <param name="b">True if the new proxy enables collocation optimization; false, otherwise.</param> 1936 /// <returns>The new proxy the specified collocation optimization.</returns> ice_collocationOptimized(bool b)1937 public ObjectPrx ice_collocationOptimized(bool b) 1938 { 1939 if(b == _reference.getCollocationOptimized()) 1940 { 1941 return this; 1942 } 1943 else 1944 { 1945 return newInstance(_reference.changeCollocationOptimized(b)); 1946 } 1947 } 1948 1949 /// <summary> 1950 /// Creates a new proxy that is identical to this proxy, but uses twoway invocations. 1951 /// </summary> 1952 /// <returns>A new proxy that uses twoway invocations.</returns> ice_twoway()1953 public ObjectPrx ice_twoway() 1954 { 1955 if(_reference.getMode() == Reference.Mode.ModeTwoway) 1956 { 1957 return this; 1958 } 1959 else 1960 { 1961 return newInstance(_reference.changeMode(Reference.Mode.ModeTwoway)); 1962 } 1963 } 1964 1965 /// <summary> 1966 /// Returns whether this proxy uses twoway invocations. 1967 /// </summary> 1968 /// <returns>True if this proxy uses twoway invocations; false, otherwise.</returns> ice_isTwoway()1969 public bool ice_isTwoway() 1970 { 1971 return _reference.getMode() == Reference.Mode.ModeTwoway; 1972 } 1973 1974 /// <summary> 1975 /// Creates a new proxy that is identical to this proxy, but uses oneway invocations. 1976 /// </summary> 1977 /// <returns>A new proxy that uses oneway invocations.</returns> ice_oneway()1978 public ObjectPrx ice_oneway() 1979 { 1980 if(_reference.getMode() == Reference.Mode.ModeOneway) 1981 { 1982 return this; 1983 } 1984 else 1985 { 1986 return newInstance(_reference.changeMode(Reference.Mode.ModeOneway)); 1987 } 1988 } 1989 1990 /// <summary> 1991 /// Returns whether this proxy uses oneway invocations. 1992 /// </summary> 1993 /// <returns>True if this proxy uses oneway invocations; false, otherwise.</returns> ice_isOneway()1994 public bool ice_isOneway() 1995 { 1996 return _reference.getMode() == Reference.Mode.ModeOneway; 1997 } 1998 1999 /// <summary> 2000 /// Creates a new proxy that is identical to this proxy, but uses batch oneway invocations. 2001 /// </summary> 2002 /// <returns>A new proxy that uses batch oneway invocations.</returns> ice_batchOneway()2003 public ObjectPrx ice_batchOneway() 2004 { 2005 if(_reference.getMode() == Reference.Mode.ModeBatchOneway) 2006 { 2007 return this; 2008 } 2009 else 2010 { 2011 return newInstance(_reference.changeMode(Reference.Mode.ModeBatchOneway)); 2012 } 2013 } 2014 2015 /// <summary> 2016 /// Returns whether this proxy uses batch oneway invocations. 2017 /// </summary> 2018 /// <returns>True if this proxy uses batch oneway invocations; false, otherwise.</returns> ice_isBatchOneway()2019 public bool ice_isBatchOneway() 2020 { 2021 return _reference.getMode() == Reference.Mode.ModeBatchOneway; 2022 } 2023 2024 /// <summary> 2025 /// Creates a new proxy that is identical to this proxy, but uses datagram invocations. 2026 /// </summary> 2027 /// <returns>A new proxy that uses datagram invocations.</returns> ice_datagram()2028 public ObjectPrx ice_datagram() 2029 { 2030 if(_reference.getMode() == Reference.Mode.ModeDatagram) 2031 { 2032 return this; 2033 } 2034 else 2035 { 2036 return newInstance(_reference.changeMode(Reference.Mode.ModeDatagram)); 2037 } 2038 } 2039 2040 /// <summary> 2041 /// Returns whether this proxy uses datagram invocations. 2042 /// </summary> 2043 /// <returns>True if this proxy uses datagram invocations; false, otherwise.</returns> ice_isDatagram()2044 public bool ice_isDatagram() 2045 { 2046 return _reference.getMode() == Reference.Mode.ModeDatagram; 2047 } 2048 2049 /// <summary> 2050 /// Creates a new proxy that is identical to this proxy, but uses batch datagram invocations. 2051 /// </summary> 2052 /// <returns>A new proxy that uses batch datagram invocations.</returns> ice_batchDatagram()2053 public ObjectPrx ice_batchDatagram() 2054 { 2055 if(_reference.getMode() == Reference.Mode.ModeBatchDatagram) 2056 { 2057 return this; 2058 } 2059 else 2060 { 2061 return newInstance(_reference.changeMode(Reference.Mode.ModeBatchDatagram)); 2062 } 2063 } 2064 2065 /// <summary> 2066 /// Returns whether this proxy uses batch datagram invocations. 2067 /// </summary> 2068 /// <returns>True if this proxy uses batch datagram invocations; false, otherwise.</returns> ice_isBatchDatagram()2069 public bool ice_isBatchDatagram() 2070 { 2071 return _reference.getMode() == Reference.Mode.ModeBatchDatagram; 2072 } 2073 2074 /// <summary> 2075 /// Creates a new proxy that is identical to this proxy, except for compression. 2076 /// </summary> 2077 /// <param name="co">True enables compression for the new proxy; false disables compression.</param> 2078 /// <returns>A new proxy with the specified compression setting.</returns> ice_compress(bool co)2079 public ObjectPrx ice_compress(bool co) 2080 { 2081 var @ref = _reference.changeCompress(co); 2082 if(@ref.Equals(_reference)) 2083 { 2084 return this; 2085 } 2086 else 2087 { 2088 return newInstance(@ref); 2089 } 2090 } 2091 2092 /// <summary> 2093 /// Obtains the compression override setting of this proxy. 2094 /// </summary> 2095 /// <returns>The compression override setting. If no optional value is present, no override is 2096 /// set. Otherwise, true if compression is enabled, false otherwise.</returns> ice_getCompress()2097 public Ice.Optional<bool> ice_getCompress() 2098 { 2099 return _reference.getCompress(); 2100 } 2101 2102 /// <summary> 2103 /// Creates a new proxy that is identical to this proxy, except for its timeout setting. 2104 /// </summary> 2105 /// <param name="t">The timeout for the new proxy in milliseconds.</param> 2106 /// <returns>A new proxy with the specified timeout.</returns> ice_timeout(int t)2107 public ObjectPrx ice_timeout(int t) 2108 { 2109 if(t < 1 && t != -1) 2110 { 2111 throw new ArgumentException("invalid value passed to ice_timeout: " + t); 2112 } 2113 var @ref = _reference.changeTimeout(t); 2114 if(@ref.Equals(_reference)) 2115 { 2116 return this; 2117 } 2118 else 2119 { 2120 return newInstance(@ref); 2121 } 2122 } 2123 2124 /// <summary> 2125 /// Obtains the timeout override of this proxy. 2126 /// </summary> 2127 /// <returns>The timeout override. If no optional value is present, no override is set. Otherwise, 2128 /// returns the timeout override value.</returns> ice_getTimeout()2129 public Ice.Optional<int> ice_getTimeout() 2130 { 2131 return _reference.getTimeout(); 2132 } 2133 2134 /// <summary> 2135 /// Creates a new proxy that is identical to this proxy, except for its connection ID. 2136 /// </summary> 2137 /// <param name="connectionId">The connection ID for the new proxy. An empty string removes the 2138 /// connection ID.</param> 2139 /// <returns>A new proxy with the specified connection ID.</returns> ice_connectionId(string connectionId)2140 public ObjectPrx ice_connectionId(string connectionId) 2141 { 2142 var @ref = _reference.changeConnectionId(connectionId); 2143 if(@ref.Equals(_reference)) 2144 { 2145 return this; 2146 } 2147 else 2148 { 2149 return newInstance(@ref); 2150 } 2151 } 2152 2153 /// <summary> 2154 /// Returns the connection id of this proxy. 2155 /// </summary> 2156 /// <returns>The connection id.</returns> ice_getConnectionId()2157 public string ice_getConnectionId() 2158 { 2159 return _reference.getConnectionId(); 2160 } 2161 2162 /// <summary> 2163 /// Returns a proxy that is identical to this proxy, except it's a fixed proxy bound 2164 /// the given connection. 2165 /// </summary> 2166 /// <param name="connection">The fixed proxy connection.</param> 2167 /// <returns>A fixed proxy bound to the given connection.</returns> ice_fixed(Ice.Connection connection)2168 public ObjectPrx ice_fixed(Ice.Connection connection) 2169 { 2170 if(connection == null) 2171 { 2172 throw new ArgumentException("invalid null connection passed to ice_fixed"); 2173 } 2174 if(!(connection is Ice.ConnectionI)) 2175 { 2176 throw new ArgumentException("invalid connection passed to ice_fixed"); 2177 } 2178 var @ref = _reference.changeConnection((Ice.ConnectionI)connection); 2179 if(@ref.Equals(_reference)) 2180 { 2181 return this; 2182 } 2183 else 2184 { 2185 return newInstance(@ref); 2186 } 2187 } 2188 2189 private class ProxyGetConnectionAsyncCallback : ProxyAsyncResultCompletionCallback<Callback_Object_ice_getConnection> 2190 { ProxyGetConnectionAsyncCallback(ObjectPrxHelperBase proxy, string operation, object cookie, AsyncCallback cb)2191 public ProxyGetConnectionAsyncCallback(ObjectPrxHelperBase proxy, string operation, object cookie, 2192 AsyncCallback cb) : 2193 base(proxy, operation, cookie, cb) 2194 { 2195 } 2196 getCompletedCallback()2197 protected override AsyncCallback getCompletedCallback() 2198 { 2199 return (AsyncResult result) => 2200 { 2201 try 2202 { 2203 result.throwLocalException(); 2204 if(responseCallback_ != null) 2205 { 2206 responseCallback_.Invoke(((ProxyGetConnection)OutgoingAsync).getConnection()); 2207 } 2208 2209 } 2210 catch(Exception ex) 2211 { 2212 if(exceptionCallback_ != null) 2213 { 2214 exceptionCallback_.Invoke(ex); 2215 } 2216 } 2217 }; 2218 } 2219 } 2220 2221 public class GetConnectionTaskCompletionCallback : TaskCompletionCallback<Connection> 2222 { GetConnectionTaskCompletionCallback(ObjectPrx proxy, IProgress<bool> progress = null, CancellationToken cancellationToken = new CancellationToken())2223 public GetConnectionTaskCompletionCallback(ObjectPrx proxy, 2224 IProgress<bool> progress = null, 2225 CancellationToken cancellationToken = new CancellationToken()) : 2226 base(progress, cancellationToken) 2227 { 2228 _proxy = proxy; 2229 } 2230 handleInvokeResponse(bool ok, OutgoingAsyncBase og)2231 public override void handleInvokeResponse(bool ok, OutgoingAsyncBase og) 2232 { 2233 SetResult(((ProxyGetConnection)og).getConnection()); 2234 } 2235 2236 private ObjectPrx _proxy; 2237 } 2238 2239 /// <summary> 2240 /// Returns the Connection for this proxy. If the proxy does not yet have an established connection, 2241 /// it first attempts to create a connection. 2242 /// </summary> 2243 /// <returns>The Connection for this proxy.</returns> 2244 /// <exception name="CollocationOptimizationException">If the proxy uses collocation optimization and denotes a 2245 /// collocated object.</exception> ice_getConnection()2246 public Connection ice_getConnection() 2247 { 2248 try 2249 { 2250 var completed = new GetConnectionTaskCompletionCallback(this); 2251 iceI_ice_getConnection(completed, true); 2252 return completed.Task.Result; 2253 } 2254 catch(AggregateException ex) 2255 { 2256 throw ex.InnerException; 2257 } 2258 } 2259 ice_getConnectionAsync(IProgress<bool> progress = null, CancellationToken cancel = new CancellationToken())2260 public Task<Connection> ice_getConnectionAsync(IProgress<bool> progress = null, 2261 CancellationToken cancel = new CancellationToken()) 2262 { 2263 var completed = new GetConnectionTaskCompletionCallback(this, progress, cancel); 2264 iceI_ice_getConnection(completed, false); 2265 return completed.Task; 2266 } 2267 begin_ice_getConnection()2268 public AsyncResult<Callback_Object_ice_getConnection> begin_ice_getConnection() 2269 { 2270 var completed = new ProxyGetConnectionAsyncCallback(this, _ice_getConnection_name, null, null); 2271 iceI_ice_getConnection(completed, false); 2272 return completed; 2273 } 2274 2275 private const string _ice_getConnection_name = "ice_getConnection"; 2276 begin_ice_getConnection(AsyncCallback cb, object cookie)2277 public AsyncResult begin_ice_getConnection(AsyncCallback cb, object cookie) 2278 { 2279 var completed = new ProxyGetConnectionAsyncCallback(this, _ice_getConnection_name, cookie, cb); 2280 iceI_ice_getConnection(completed, false); 2281 return completed; 2282 } 2283 end_ice_getConnection(AsyncResult r)2284 public Connection end_ice_getConnection(AsyncResult r) 2285 { 2286 var resultI = AsyncResultI.check(r, this, _ice_getConnection_name); 2287 resultI.wait(); 2288 return ((ProxyGetConnection)resultI.OutgoingAsync).getConnection(); 2289 } 2290 iceI_ice_getConnection(OutgoingAsyncCompletionCallback completed, bool synchronous)2291 private void iceI_ice_getConnection(OutgoingAsyncCompletionCallback completed, bool synchronous) 2292 { 2293 var outgoing = new ProxyGetConnection(this, completed); 2294 try 2295 { 2296 outgoing.invoke(_ice_getConnection_name, synchronous); 2297 } 2298 catch(Exception ex) 2299 { 2300 outgoing.abort(ex); 2301 } 2302 } 2303 2304 /// <summary> 2305 /// Returns the cached Connection for this proxy. If the proxy does not yet have an established 2306 /// connection, it does not attempt to create a connection. 2307 /// </summary> 2308 /// <returns>The cached Connection for this proxy (null if the proxy does not have 2309 /// an established connection).</returns> 2310 /// <exception name="CollocationOptimizationException">If the proxy uses collocation optimization and denotes a 2311 /// collocated object.</exception> ice_getCachedConnection()2312 public Connection ice_getCachedConnection() 2313 { 2314 RequestHandler handler; 2315 lock(this) 2316 { 2317 handler = _requestHandler; 2318 } 2319 2320 if(handler != null) 2321 { 2322 try 2323 { 2324 return handler.getConnection(); 2325 } 2326 catch(LocalException) 2327 { 2328 } 2329 } 2330 return null; 2331 } 2332 2333 private class ProxyFlushBatchRequestsAsyncCallback : AsyncResultCompletionCallback 2334 { ProxyFlushBatchRequestsAsyncCallback(ObjectPrx proxy, string operation, object cookie, AsyncCallback callback)2335 public ProxyFlushBatchRequestsAsyncCallback(ObjectPrx proxy, 2336 string operation, 2337 object cookie, 2338 AsyncCallback callback) : 2339 base(proxy.ice_getCommunicator(), ((ObjectPrxHelperBase)proxy).iceReference().getInstance(), 2340 operation, cookie, callback) 2341 { 2342 _proxy = proxy; 2343 } 2344 getProxy()2345 public override ObjectPrx getProxy() 2346 { 2347 return _proxy; 2348 } 2349 getCompletedCallback()2350 protected override AsyncCallback getCompletedCallback() 2351 { 2352 return (AsyncResult result) => 2353 { 2354 try 2355 { 2356 result.throwLocalException(); 2357 } 2358 catch(Exception ex) 2359 { 2360 if(exceptionCallback_ != null) 2361 { 2362 exceptionCallback_.Invoke(ex); 2363 } 2364 } 2365 }; 2366 } 2367 2368 private ObjectPrx _proxy; 2369 } 2370 2371 /// <summary> 2372 /// Flushes any pending batched requests for this communicator. The call blocks until the flush is complete. 2373 /// </summary> ice_flushBatchRequests()2374 public void ice_flushBatchRequests() 2375 { 2376 try 2377 { 2378 var completed = new FlushBatchTaskCompletionCallback(); 2379 iceI_ice_flushBatchRequests(completed, true); 2380 completed.Task.Wait(); 2381 } 2382 catch(AggregateException ex) 2383 { 2384 throw ex.InnerException; 2385 } 2386 } 2387 2388 internal const string _ice_flushBatchRequests_name = "ice_flushBatchRequests"; 2389 ice_flushBatchRequestsAsync(IProgress<bool> progress = null, CancellationToken cancel = new CancellationToken())2390 public Task ice_flushBatchRequestsAsync(IProgress<bool> progress = null, 2391 CancellationToken cancel = new CancellationToken()) 2392 { 2393 var completed = new FlushBatchTaskCompletionCallback(progress, cancel); 2394 iceI_ice_flushBatchRequests(completed, false); 2395 return completed.Task; 2396 } 2397 begin_ice_flushBatchRequests(AsyncCallback cb = null, object cookie = null)2398 public AsyncResult begin_ice_flushBatchRequests(AsyncCallback cb = null, object cookie = null) 2399 { 2400 var completed = new ProxyFlushBatchRequestsAsyncCallback(this, _ice_flushBatchRequests_name, cookie, cb); 2401 iceI_ice_flushBatchRequests(completed, false); 2402 return completed; 2403 } 2404 end_ice_flushBatchRequests(AsyncResult r)2405 public void end_ice_flushBatchRequests(AsyncResult r) 2406 { 2407 var resultI = AsyncResultI.check(r, this, _ice_flushBatchRequests_name); 2408 resultI.wait(); 2409 } 2410 iceI_ice_flushBatchRequests(OutgoingAsyncCompletionCallback completed, bool synchronous)2411 private void iceI_ice_flushBatchRequests(OutgoingAsyncCompletionCallback completed, bool synchronous) 2412 { 2413 var outgoing = new ProxyFlushBatchAsync(this, completed); 2414 try 2415 { 2416 outgoing.invoke(_ice_flushBatchRequests_name, synchronous); 2417 } 2418 catch(Exception ex) 2419 { 2420 outgoing.abort(ex); 2421 } 2422 } 2423 ice_scheduler()2424 public System.Threading.Tasks.TaskScheduler ice_scheduler() 2425 { 2426 return _reference.getThreadPool(); 2427 } 2428 2429 /// <summary> 2430 /// Returns whether this proxy equals the passed object. Two proxies are equal if they are equal in all 2431 /// respects, that is, if their object identity, endpoints timeout settings, and so on are all equal. 2432 /// </summary> 2433 /// <param name="r">The object to compare this proxy with.</param> 2434 /// <returns>True if this proxy is equal to r; false, otherwise.</returns> Equals(object r)2435 public override bool Equals(object r) 2436 { 2437 var rhs = r as ObjectPrxHelperBase; 2438 return ReferenceEquals(rhs, null) ? false : _reference.Equals(rhs._reference); 2439 } 2440 2441 /// <summary> 2442 /// Returns whether two proxies are equal. Two proxies are equal if they are equal in all 2443 /// respects, that is, if their object identity, endpoints timeout settings, and so on are all equal. 2444 /// </summary> 2445 /// <param name="lhs">A proxy to compare with the proxy rhs.</param> 2446 /// <param name="rhs">A proxy to compare with the proxy lhs.</param> 2447 /// <returns>True if the proxies are equal; false, otherwise.</returns> Equals(ObjectPrxHelperBase lhs, ObjectPrxHelperBase rhs)2448 public static bool Equals(ObjectPrxHelperBase lhs, ObjectPrxHelperBase rhs) 2449 { 2450 return ReferenceEquals(lhs, null) ? ReferenceEquals(rhs, null) : lhs.Equals(rhs); 2451 } 2452 2453 /// <summary> 2454 /// Returns whether two proxies are equal. Two proxies are equal if they are equal in all 2455 /// respects, that is, if their object identity, endpoints timeout settings, and so on are all equal. 2456 /// </summary> 2457 /// <param name="lhs">A proxy to compare with the proxy rhs.</param> 2458 /// <param name="rhs">A proxy to compare with the proxy lhs.</param> 2459 /// <returns>True if the proxies are equal; false, otherwise.</returns> operator ==(ObjectPrxHelperBase lhs, ObjectPrxHelperBase rhs)2460 public static bool operator==(ObjectPrxHelperBase lhs, ObjectPrxHelperBase rhs) 2461 { 2462 return Equals(lhs, rhs); 2463 } 2464 2465 /// <summary> 2466 /// Returns whether two proxies are not equal. Two proxies are equal if they are equal in all 2467 /// respects, that is, if their object identity, endpoints timeout settings, and so on are all equal. 2468 /// </summary> 2469 /// <param name="lhs">A proxy to compare with the proxy rhs.</param> 2470 /// <param name="rhs">A proxy to compare with the proxy lhs.</param> 2471 /// <returns>True if the proxies are not equal; false, otherwise.</returns> operator !=(ObjectPrxHelperBase lhs, ObjectPrxHelperBase rhs)2472 public static bool operator!=(ObjectPrxHelperBase lhs, ObjectPrxHelperBase rhs) 2473 { 2474 return !Equals(lhs, rhs); 2475 } 2476 2477 [EditorBrowsable(EditorBrowsableState.Never)] iceWrite(OutputStream os)2478 public void iceWrite(OutputStream os) 2479 { 2480 _reference.getIdentity().ice_writeMembers(os); 2481 _reference.streamWrite(os); 2482 } 2483 2484 [EditorBrowsable(EditorBrowsableState.Never)] iceReference()2485 public Reference iceReference() 2486 { 2487 return _reference; 2488 } 2489 2490 [EditorBrowsable(EditorBrowsableState.Never)] iceCopyFrom(ObjectPrx from)2491 public void iceCopyFrom(ObjectPrx from) 2492 { 2493 lock(from) 2494 { 2495 var h = (ObjectPrxHelperBase)from; 2496 _reference = h._reference; 2497 _requestHandler = h._requestHandler; 2498 } 2499 } 2500 2501 [EditorBrowsable(EditorBrowsableState.Never)] iceHandleException(Exception ex, RequestHandler handler, OperationMode mode, bool sent, ref int cnt)2502 public int iceHandleException(Exception ex, RequestHandler handler, OperationMode mode, bool sent, 2503 ref int cnt) 2504 { 2505 iceUpdateRequestHandler(handler, null); // Clear the request handler 2506 2507 // 2508 // We only retry local exception, system exceptions aren't retried. 2509 // 2510 // A CloseConnectionException indicates graceful server shutdown, and is therefore 2511 // always repeatable without violating "at-most-once". That's because by sending a 2512 // close connection message, the server guarantees that all outstanding requests 2513 // can safely be repeated. 2514 // 2515 // An ObjectNotExistException can always be retried as well without violating 2516 // "at-most-once" (see the implementation of the checkRetryAfterException method 2517 // of the ProxyFactory class for the reasons why it can be useful). 2518 // 2519 // If the request didn't get sent or if it's non-mutating or idempotent it can 2520 // also always be retried if the retry count isn't reached. 2521 // 2522 if(ex is LocalException && (!sent || 2523 mode == OperationMode.Nonmutating || mode == OperationMode.Idempotent || 2524 ex is CloseConnectionException || 2525 ex is ObjectNotExistException)) 2526 { 2527 try 2528 { 2529 return _reference.getInstance().proxyFactory().checkRetryAfterException((LocalException)ex, 2530 _reference, 2531 ref cnt); 2532 } 2533 catch(CommunicatorDestroyedException) 2534 { 2535 // 2536 // The communicator is already destroyed, so we cannot retry. 2537 // 2538 throw ex; 2539 } 2540 } 2541 else 2542 { 2543 throw ex; // Retry could break at-most-once semantics, don't retry. 2544 } 2545 } 2546 2547 [EditorBrowsable(EditorBrowsableState.Never)] iceCheckTwowayOnly(string name)2548 public void iceCheckTwowayOnly(string name) 2549 { 2550 // 2551 // No mutex lock necessary, there is nothing mutable in this 2552 // operation. 2553 // 2554 2555 if(!ice_isTwoway()) 2556 { 2557 throw new TwowayOnlyException(name); 2558 } 2559 } 2560 2561 [EditorBrowsable(EditorBrowsableState.Never)] iceCheckAsyncTwowayOnly(string name)2562 public void iceCheckAsyncTwowayOnly(string name) 2563 { 2564 // 2565 // No mutex lock necessary, there is nothing mutable in this 2566 // operation. 2567 // 2568 2569 if(!ice_isTwoway()) 2570 { 2571 throw new ArgumentException("`" + name + "' can only be called with a twoway proxy"); 2572 } 2573 } 2574 2575 [EditorBrowsable(EditorBrowsableState.Never)] iceGetRequestHandler()2576 public RequestHandler iceGetRequestHandler() 2577 { 2578 if(_reference.getCacheConnection()) 2579 { 2580 lock(this) 2581 { 2582 if(_requestHandler != null) 2583 { 2584 return _requestHandler; 2585 } 2586 } 2587 } 2588 return _reference.getRequestHandler(this); 2589 } 2590 2591 [EditorBrowsable(EditorBrowsableState.Never)] 2592 public BatchRequestQueue iceGetBatchRequestQueue()2593 iceGetBatchRequestQueue() 2594 { 2595 lock(this) 2596 { 2597 if(_batchRequestQueue == null) 2598 { 2599 _batchRequestQueue = _reference.getBatchRequestQueue(); 2600 } 2601 return _batchRequestQueue; 2602 } 2603 } 2604 2605 [EditorBrowsable(EditorBrowsableState.Never)] 2606 public RequestHandler iceSetRequestHandler(RequestHandler handler)2607 iceSetRequestHandler(RequestHandler handler) 2608 { 2609 if(_reference.getCacheConnection()) 2610 { 2611 lock(this) 2612 { 2613 if(_requestHandler == null) 2614 { 2615 _requestHandler = handler; 2616 } 2617 return _requestHandler; 2618 } 2619 } 2620 return handler; 2621 } 2622 2623 [EditorBrowsable(EditorBrowsableState.Never)] iceUpdateRequestHandler(RequestHandler previous, RequestHandler handler)2624 public void iceUpdateRequestHandler(RequestHandler previous, RequestHandler handler) 2625 { 2626 if(_reference.getCacheConnection() && previous != null) 2627 { 2628 lock(this) 2629 { 2630 if(_requestHandler != null && _requestHandler != handler) 2631 { 2632 // 2633 // Update the request handler only if "previous" is the same 2634 // as the current request handler. This is called after 2635 // connection binding by the connect request handler. We only 2636 // replace the request handler if the current handler is the 2637 // connect request handler. 2638 // 2639 _requestHandler = _requestHandler.update(previous, handler); 2640 } 2641 } 2642 } 2643 } 2644 2645 protected OutgoingAsyncT<T> getOutgoingAsync(OutgoingAsyncCompletionCallback completed)2646 getOutgoingAsync<T>(OutgoingAsyncCompletionCallback completed) 2647 { 2648 bool haveEntry = false; 2649 InputStream iss = null; 2650 OutputStream os = null; 2651 2652 if(_reference.getInstance().cacheMessageBuffers() > 0) 2653 { 2654 lock(this) 2655 { 2656 if(_streamCache != null && _streamCache.Count > 0) 2657 { 2658 haveEntry = true; 2659 iss = _streamCache.First.Value.iss; 2660 os = _streamCache.First.Value.os; 2661 2662 _streamCache.RemoveFirst(); 2663 } 2664 } 2665 } 2666 if(!haveEntry) 2667 { 2668 return new OutgoingAsyncT<T>(this, completed); 2669 } 2670 else 2671 { 2672 return new OutgoingAsyncT<T>(this, completed, os, iss); 2673 } 2674 } 2675 2676 private class InvokeOutgoingAsyncT : OutgoingAsync 2677 { InvokeOutgoingAsyncT(ObjectPrxHelperBase prx, OutgoingAsyncCompletionCallback completionCallback, OutputStream os = null, InputStream iss = null)2678 public InvokeOutgoingAsyncT(ObjectPrxHelperBase prx, 2679 OutgoingAsyncCompletionCallback completionCallback, 2680 OutputStream os = null, 2681 InputStream iss = null) : base(prx, completionCallback, os, iss) 2682 { 2683 } 2684 invoke(string operation, OperationMode mode, byte[] inParams, Dictionary<string, string> context, bool synchronous)2685 public void invoke(string operation, OperationMode mode, byte[] inParams, 2686 Dictionary<string, string> context, bool synchronous) 2687 { 2688 try 2689 { 2690 prepare(operation, mode, context); 2691 if(inParams == null || inParams.Length == 0) 2692 { 2693 os_.writeEmptyEncapsulation(encoding_); 2694 } 2695 else 2696 { 2697 os_.writeEncapsulation(inParams); 2698 } 2699 invoke(operation, synchronous); 2700 } 2701 catch(Exception ex) 2702 { 2703 abort(ex); 2704 } 2705 } 2706 2707 public Object_Ice_invokeResult getResult(bool ok)2708 getResult(bool ok) 2709 { 2710 try 2711 { 2712 var ret = new Object_Ice_invokeResult(); 2713 EncodingVersion encoding; 2714 if(proxy_.iceReference().getMode() == Reference.Mode.ModeTwoway) 2715 { 2716 ret.outEncaps = is_.readEncapsulation(out encoding); 2717 } 2718 else 2719 { 2720 ret.outEncaps = null; 2721 } 2722 ret.returnValue = ok; 2723 return ret; 2724 } 2725 finally 2726 { 2727 cacheMessageBuffers(); 2728 } 2729 } 2730 } 2731 2732 public class InvokeAsyncResultCompletionCallback : ProxyAsyncResultCompletionCallback<Callback_Object_ice_invoke> 2733 { InvokeAsyncResultCompletionCallback(ObjectPrxHelperBase proxy, string operation, object cookie, AsyncCallback callback)2734 public InvokeAsyncResultCompletionCallback(ObjectPrxHelperBase proxy, 2735 string operation, 2736 object cookie, 2737 AsyncCallback callback) : 2738 base(proxy, operation, cookie, callback) 2739 { 2740 } 2741 getCompletedCallback()2742 override protected AsyncCallback getCompletedCallback() 2743 { 2744 return (AsyncResult r) => 2745 { 2746 Debug.Assert(r == this); 2747 try 2748 { 2749 Object_Ice_invokeResult result = ((InvokeOutgoingAsyncT)outgoing_).getResult(wait()); 2750 try 2751 { 2752 if(responseCallback_ != null) 2753 { 2754 responseCallback_.Invoke(result.returnValue, result.outEncaps); 2755 } 2756 } 2757 catch(Exception ex) 2758 { 2759 throw new AggregateException(ex); 2760 } 2761 } 2762 catch(Exception ex) 2763 { 2764 if(exceptionCallback_ != null) 2765 { 2766 exceptionCallback_.Invoke(ex); 2767 } 2768 } 2769 }; 2770 } 2771 }; 2772 2773 private class InvokeTaskCompletionCallback : TaskCompletionCallback<Object_Ice_invokeResult> 2774 { InvokeTaskCompletionCallback(IProgress<bool> progress, CancellationToken cancellationToken)2775 public InvokeTaskCompletionCallback(IProgress<bool> progress, CancellationToken cancellationToken) : 2776 base(progress, cancellationToken) 2777 { 2778 } 2779 handleInvokeSent(bool sentSynchronously, bool done, bool alreadySent, OutgoingAsyncBase og)2780 public override void handleInvokeSent(bool sentSynchronously, bool done, bool alreadySent, 2781 OutgoingAsyncBase og) 2782 { 2783 if(progress_ != null && !alreadySent) 2784 { 2785 progress_.Report(sentSynchronously); 2786 } 2787 if(done) 2788 { 2789 SetResult(new Object_Ice_invokeResult(true, null)); 2790 } 2791 } 2792 handleInvokeResponse(bool ok, OutgoingAsyncBase og)2793 public override void handleInvokeResponse(bool ok, OutgoingAsyncBase og) 2794 { 2795 SetResult(((InvokeOutgoingAsyncT)og).getResult(ok)); 2796 } 2797 } 2798 2799 private InvokeOutgoingAsyncT getInvokeOutgoingAsync(OutgoingAsyncCompletionCallback completed)2800 getInvokeOutgoingAsync(OutgoingAsyncCompletionCallback completed) 2801 { 2802 bool haveEntry = false; 2803 InputStream iss = null; 2804 OutputStream os = null; 2805 2806 if(_reference.getInstance().cacheMessageBuffers() > 0) 2807 { 2808 lock(this) 2809 { 2810 if(_streamCache != null && _streamCache.Count > 0) 2811 { 2812 haveEntry = true; 2813 iss = _streamCache.First.Value.iss; 2814 os = _streamCache.First.Value.os; 2815 2816 _streamCache.RemoveFirst(); 2817 } 2818 } 2819 } 2820 if(!haveEntry) 2821 { 2822 return new InvokeOutgoingAsyncT(this, completed); 2823 } 2824 else 2825 { 2826 return new InvokeOutgoingAsyncT(this, completed, os, iss); 2827 } 2828 } 2829 2830 /// <summary> 2831 /// Only for internal use by OutgoingAsync 2832 /// </summary> 2833 /// <param name="iss"></param> 2834 /// <param name="os"></param> 2835 [EditorBrowsable(EditorBrowsableState.Never)] 2836 public void cacheMessageBuffers(InputStream iss, OutputStream os)2837 cacheMessageBuffers(InputStream iss, OutputStream os) 2838 { 2839 lock(this) 2840 { 2841 if(_streamCache == null) 2842 { 2843 _streamCache = new LinkedList<StreamCacheEntry>(); 2844 } 2845 StreamCacheEntry cacheEntry; 2846 cacheEntry.iss = iss; 2847 cacheEntry.os = os; 2848 _streamCache.AddLast(cacheEntry); 2849 } 2850 } 2851 2852 /// <summary> 2853 /// Only for internal use by ProxyFactory 2854 /// </summary> 2855 /// <param name="ref"></param> 2856 [EditorBrowsable(EditorBrowsableState.Never)] 2857 public void setup(Reference @ref) 2858 { 2859 // 2860 // No need to synchronize, as this operation is only called 2861 // upon initial initialization. 2862 // 2863 Debug.Assert(_reference == null); 2864 Debug.Assert(_requestHandler == null); 2865 2866 _reference = @ref; 2867 } 2868 2869 private ObjectPrxHelperBase newInstance(Reference @ref) 2870 { 2871 var proxy = (ObjectPrxHelperBase)Activator.CreateInstance(GetType()); 2872 proxy.setup(@ref); 2873 return proxy; 2874 } 2875 2876 private Reference _reference; 2877 private RequestHandler _requestHandler; 2878 private BatchRequestQueue _batchRequestQueue; 2879 private struct StreamCacheEntry 2880 { 2881 public InputStream iss; 2882 public OutputStream os; 2883 } 2884 2885 private LinkedList<StreamCacheEntry> _streamCache; 2886 } 2887 2888 /// <summary> 2889 /// Base class for all proxy helpers. 2890 /// </summary> 2891 public class ObjectPrxHelper : ObjectPrxHelperBase 2892 { 2893 /// <summary> 2894 /// Casts a proxy to {@link ObjectPrx}. This call contacts 2895 /// the server and will throw an Ice run-time exception if the target 2896 /// object does not exist or the server cannot be reached. 2897 /// </summary> 2898 /// <param name="b">The proxy to cast to ObjectPrx.</param> 2899 /// <returns>b.</returns> checkedCast(ObjectPrx b)2900 public static ObjectPrx checkedCast(ObjectPrx b) 2901 { 2902 return b; 2903 } 2904 2905 /// <summary> 2906 /// Casts a proxy to {@link ObjectPrx}. This call contacts 2907 /// the server and throws an Ice run-time exception if the target 2908 /// object does not exist or the server cannot be reached. 2909 /// </summary> 2910 /// <param name="b">The proxy to cast to ObjectPrx.</param> 2911 /// <param name="ctx">The Context map for the invocation.</param> 2912 /// <returns>b.</returns> checkedCast(ObjectPrx b, Dictionary<string, string> ctx)2913 public static ObjectPrx checkedCast(ObjectPrx b, Dictionary<string, string> ctx) 2914 { 2915 return b; 2916 } 2917 2918 /// <summary> 2919 /// Creates a new proxy that is identical to the passed proxy, except 2920 /// for its facet. This call contacts 2921 /// the server and throws an Ice run-time exception if the target 2922 /// object does not exist, the specified facet does not exist, or the server cannot be reached. 2923 /// </summary> 2924 /// <param name="b">The proxy to cast to ObjectPrx.</param> 2925 /// <param name="f">The facet for the new proxy.</param> 2926 /// <returns>The new proxy with the specified facet.</returns> checkedCast(ObjectPrx b, string f)2927 public static ObjectPrx checkedCast(ObjectPrx b, string f) 2928 { 2929 ObjectPrx d = null; 2930 if(b != null) 2931 { 2932 try 2933 { 2934 var bb = b.ice_facet(f); 2935 var ok = bb.ice_isA("::Ice::Object"); 2936 Debug.Assert(ok); 2937 ObjectPrxHelper h = new ObjectPrxHelper(); 2938 h.iceCopyFrom(bb); 2939 d = h; 2940 } 2941 catch(FacetNotExistException) 2942 { 2943 } 2944 } 2945 return d; 2946 } 2947 2948 /// <summary> 2949 /// Creates a new proxy that is identical to the passed proxy, except 2950 /// for its facet. This call contacts 2951 /// the server and throws an Ice run-time exception if the target 2952 /// object does not exist, the specified facet does not exist, or the server cannot be reached. 2953 /// </summary> 2954 /// <param name="b">The proxy to cast to ObjectPrx.</param> 2955 /// <param name="f">The facet for the new proxy.</param> 2956 /// <param name="ctx">The Context map for the invocation.</param> 2957 /// <returns>The new proxy with the specified facet.</returns> checkedCast(ObjectPrx b, string f, Dictionary<string, string> ctx)2958 public static ObjectPrx checkedCast(ObjectPrx b, string f, Dictionary<string, string> ctx) 2959 { 2960 ObjectPrx d = null; 2961 if(b != null) 2962 { 2963 try 2964 { 2965 var bb = b.ice_facet(f); 2966 var ok = bb.ice_isA("::Ice::Object", ctx); 2967 Debug.Assert(ok); 2968 ObjectPrxHelper h = new ObjectPrxHelper(); 2969 h.iceCopyFrom(bb); 2970 d = h; 2971 } 2972 catch(FacetNotExistException) 2973 { 2974 } 2975 } 2976 return d; 2977 } 2978 2979 /// <summary> 2980 /// Casts a proxy to {@link ObjectPrx}. This call does 2981 /// not contact the server and always succeeds. 2982 /// </summary> 2983 /// <param name="b">The proxy to cast to ObjectPrx.</param> 2984 /// <returns>b.</returns> uncheckedCast(ObjectPrx b)2985 public static ObjectPrx uncheckedCast(ObjectPrx b) 2986 { 2987 return b; 2988 } 2989 2990 /// <summary> 2991 /// Creates a new proxy that is identical to the passed proxy, except 2992 /// for its facet. This call does not contact the server and always succeeds. 2993 /// </summary> 2994 /// <param name="b">The proxy to cast to ObjectPrx.</param> 2995 /// <param name="f">The facet for the new proxy.</param> 2996 /// <returns>The new proxy with the specified facet.</returns> uncheckedCast(ObjectPrx b, string f)2997 public static ObjectPrx uncheckedCast(ObjectPrx b, string f) 2998 { 2999 ObjectPrx d = null; 3000 if(b != null) 3001 { 3002 var bb = b.ice_facet(f); 3003 var h = new ObjectPrxHelper(); 3004 h.iceCopyFrom(bb); 3005 d = h; 3006 } 3007 return d; 3008 } 3009 3010 /// <summary> 3011 /// Returns the Slice type id of the interface or class associated 3012 /// with this proxy class. 3013 /// </summary> 3014 /// <returns>The type id, "::Ice::Object".</returns> ice_staticId()3015 public static string ice_staticId() 3016 { 3017 return ObjectImpl.ice_staticId(); 3018 } 3019 } 3020 } 3021