| | 1 | | // Copyright (c) ZeroC, Inc. |
| | 2 | |
|
| | 3 | | #nullable enable |
| | 4 | |
|
| | 5 | | using Ice.Internal; |
| | 6 | | using System.ComponentModel; |
| | 7 | | using System.Diagnostics.CodeAnalysis; |
| | 8 | |
|
| | 9 | | namespace Ice; |
| | 10 | |
|
| | 11 | | /// <summary> |
| | 12 | | /// Base interface of all object proxies. |
| | 13 | | /// </summary> |
| | 14 | | public interface ObjectPrx : IEquatable<ObjectPrx> |
| | 15 | | { |
| | 16 | | /// <summary> |
| | 17 | | /// Gets the communicator that created this proxy. |
| | 18 | | /// </summary> |
| | 19 | | /// <returns>The communicator that created this proxy.</returns> |
| | 20 | | Communicator ice_getCommunicator(); |
| | 21 | |
|
| | 22 | | /// <summary> |
| | 23 | | /// Tests whether this object supports a specific Slice interface. |
| | 24 | | /// </summary> |
| | 25 | | /// <param name="id">The type ID of the Slice interface to test against.</param> |
| | 26 | | /// <param name="context">The request context.</param> |
| | 27 | | /// <returns>True if the target object has the interface specified by id or derives |
| | 28 | | /// from the interface specified by id.</returns> |
| | 29 | | bool ice_isA(string id, Dictionary<string, string>? context = null); |
| | 30 | |
|
| | 31 | | /// <summary> |
| | 32 | | /// Tests whether this object supports a specific Slice interface. |
| | 33 | | /// </summary> |
| | 34 | | /// <param name="id">The type ID of the Slice interface to test against.</param> |
| | 35 | | /// <param name="context">The request context.</param> |
| | 36 | | /// <param name="progress">Sent progress provider.</param> |
| | 37 | | /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> |
| | 38 | | /// <returns>The task object representing the asynchronous operation.</returns> |
| | 39 | | Task<bool> ice_isAAsync( |
| | 40 | | string id, |
| | 41 | | Dictionary<string, string>? context = null, |
| | 42 | | IProgress<bool>? progress = null, |
| | 43 | | CancellationToken cancel = default); |
| | 44 | |
|
| | 45 | | /// <summary> |
| | 46 | | /// Tests whether the target object of this proxy can be reached. |
| | 47 | | /// </summary> |
| | 48 | | /// <param name="context">The request context.</param> |
| | 49 | | void ice_ping(Dictionary<string, string>? context = null); |
| | 50 | |
|
| | 51 | | /// <summary> |
| | 52 | | /// Tests whether the target object of this proxy can be reached. |
| | 53 | | /// </summary> |
| | 54 | | /// <param name="context">The request context.</param> |
| | 55 | | /// <param name="progress">Sent progress provider.</param> |
| | 56 | | /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> |
| | 57 | | /// <returns>The task object representing the asynchronous operation.</returns> |
| | 58 | | Task ice_pingAsync( |
| | 59 | | Dictionary<string, string>? context = null, |
| | 60 | | IProgress<bool>? progress = null, |
| | 61 | | CancellationToken cancel = default); |
| | 62 | |
|
| | 63 | | /// <summary> |
| | 64 | | /// Gets the Slice type IDs of the interfaces supported by the target object of this proxy. |
| | 65 | | /// </summary> |
| | 66 | | /// <param name="context">The request context.</param> |
| | 67 | | /// <returns>The Slice type IDs of the interfaces supported by the target object, in alphabetical order. |
| | 68 | | /// </returns> |
| | 69 | | string[] ice_ids(Dictionary<string, string>? context = null); |
| | 70 | |
|
| | 71 | | /// <summary> |
| | 72 | | /// Gets the Slice type IDs of the interfaces supported by the target object of this proxy. |
| | 73 | | /// </summary> |
| | 74 | | /// <param name="context">The request context.</param> |
| | 75 | | /// <param name="progress">Sent progress provider.</param> |
| | 76 | | /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> |
| | 77 | | /// <returns>The task object representing the asynchronous operation.</returns> |
| | 78 | | Task<string[]> ice_idsAsync( |
| | 79 | | Dictionary<string, string>? context = null, |
| | 80 | | IProgress<bool>? progress = null, |
| | 81 | | CancellationToken cancel = default); |
| | 82 | |
|
| | 83 | | /// <summary> |
| | 84 | | /// Gets the Slice type ID of the most-derived interface supported by the target object of this proxy. |
| | 85 | | /// </summary> |
| | 86 | | /// <param name="context">The request context.</param> |
| | 87 | | /// <returns>The Slice type ID of the most-derived interface.</returns> |
| | 88 | | string ice_id(Dictionary<string, string>? context = null); |
| | 89 | |
|
| | 90 | | /// <summary> |
| | 91 | | /// Gets the Slice type ID of the most-derived interface supported by the target object of this proxy. |
| | 92 | | /// </summary> |
| | 93 | | /// <param name="context">The request context.</param> |
| | 94 | | /// <param name="progress">Sent progress provider.</param> |
| | 95 | | /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> |
| | 96 | | /// <returns>The task object representing the asynchronous operation.</returns> |
| | 97 | | Task<string> ice_idAsync( |
| | 98 | | Dictionary<string, string>? context = null, |
| | 99 | | IProgress<bool>? progress = null, |
| | 100 | | CancellationToken cancel = default); |
| | 101 | |
|
| | 102 | | /// <summary> |
| | 103 | | /// Invokes an operation dynamically. |
| | 104 | | /// </summary> |
| | 105 | | /// <param name="operation">The name of the operation to invoke.</param> |
| | 106 | | /// <param name="mode">The operation mode (normal or idempotent).</param> |
| | 107 | | /// <param name="inEncaps">The encoded in-parameters for the operation.</param> |
| | 108 | | /// <param name="outEncaps">The encoded out-parameters and return value |
| | 109 | | /// for the operation. The return value follows any out-parameters.</param> |
| | 110 | | /// <param name="context">The request context.</param> |
| | 111 | | /// <returns>If the operation completed successfully, the return value |
| | 112 | | /// is true. If the operation raises a user exception, |
| | 113 | | /// the return value is false; in this case, outEncaps |
| | 114 | | /// contains the encoded user exception. If the operation raises a run-time exception, |
| | 115 | | /// it throws it directly.</returns> |
| | 116 | | bool ice_invoke( |
| | 117 | | string operation, |
| | 118 | | OperationMode mode, |
| | 119 | | byte[] inEncaps, |
| | 120 | | out byte[] outEncaps, |
| | 121 | | Dictionary<string, string>? context = null); |
| | 122 | |
|
| | 123 | | /// <summary> |
| | 124 | | /// Invokes an operation dynamically. |
| | 125 | | /// </summary> |
| | 126 | | /// <param name="operation">The name of the operation to invoke.</param> |
| | 127 | | /// <param name="mode">The operation mode (normal or idempotent).</param> |
| | 128 | | /// <param name="inEncaps">The encoded in-parameters for the operation.</param> |
| | 129 | | /// <param name="context">The request context.</param> |
| | 130 | | /// <param name="progress">Sent progress provider.</param> |
| | 131 | | /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> |
| | 132 | | /// <returns>The task object representing the asynchronous operation.</returns> |
| | 133 | | Task<Object_Ice_invokeResult> |
| | 134 | | ice_invokeAsync( |
| | 135 | | string operation, |
| | 136 | | OperationMode mode, |
| | 137 | | byte[] inEncaps, |
| | 138 | | Dictionary<string, string>? context = null, |
| | 139 | | IProgress<bool>? progress = null, |
| | 140 | | CancellationToken cancel = default); |
| | 141 | |
|
| | 142 | | /// <summary> |
| | 143 | | /// Gets the identity embedded in this proxy. |
| | 144 | | /// <returns>The identity of the target object.</returns> |
| | 145 | | /// </summary> |
| | 146 | | Identity ice_getIdentity(); |
| | 147 | |
|
| | 148 | | /// <summary> |
| | 149 | | /// Creates a new proxy that is identical to this proxy, except for the per-proxy context. |
| | 150 | | /// <param name="newIdentity">The identity for the new proxy.</param> |
| | 151 | | /// <returns>The proxy with the new identity.</returns> |
| | 152 | | /// </summary> |
| | 153 | | ObjectPrx ice_identity(Identity newIdentity); |
| | 154 | |
|
| | 155 | | /// <summary> |
| | 156 | | /// Gets the per-proxy context for this proxy. |
| | 157 | | /// </summary> |
| | 158 | | /// <returns>The per-proxy context. If the proxy does not have a per-proxy (implicit) context, the return value |
| | 159 | | /// is null.</returns> |
| | 160 | | Dictionary<string, string> ice_getContext(); |
| | 161 | |
|
| | 162 | | /// <summary> |
| | 163 | | /// Creates a new proxy that is identical to this proxy, except for the per-proxy context. |
| | 164 | | /// </summary> |
| | 165 | | /// <param name="newContext">The context for the new proxy.</param> |
| | 166 | | /// <returns>The proxy with the new per-proxy context.</returns> |
| | 167 | | ObjectPrx ice_context(Dictionary<string, string> newContext); |
| | 168 | |
|
| | 169 | | /// <summary> |
| | 170 | | /// Gets the facet for this proxy. |
| | 171 | | /// </summary> |
| | 172 | | /// <returns>The facet for this proxy. If the proxy uses the default facet, the return value is the |
| | 173 | | /// empty string.</returns> |
| | 174 | | string ice_getFacet(); |
| | 175 | |
|
| | 176 | | /// <summary> |
| | 177 | | /// Creates a new proxy that is identical to this proxy, except for the facet. |
| | 178 | | /// </summary> |
| | 179 | | /// <param name="newFacet">The facet for the new proxy.</param> |
| | 180 | | /// <returns>The proxy with the new facet.</returns> |
| | 181 | | ObjectPrx ice_facet(string newFacet); |
| | 182 | |
|
| | 183 | | /// <summary> |
| | 184 | | /// Gets the adapter ID for this proxy. |
| | 185 | | /// </summary> |
| | 186 | | /// <returns>The adapter ID. If the proxy does not have an adapter ID, the return value is the |
| | 187 | | /// empty string.</returns> |
| | 188 | | string ice_getAdapterId(); |
| | 189 | |
|
| | 190 | | /// <summary> |
| | 191 | | /// Creates a new proxy that is identical to this proxy, except for the adapter ID. |
| | 192 | | /// </summary> |
| | 193 | | /// <param name="newAdapterId">The adapter ID for the new proxy.</param> |
| | 194 | | /// <returns>The proxy with the new adapter ID.</returns> |
| | 195 | | ObjectPrx ice_adapterId(string newAdapterId); |
| | 196 | |
|
| | 197 | | /// <summary> |
| | 198 | | /// Gets the endpoints used by this proxy. |
| | 199 | | /// </summary> |
| | 200 | | /// <returns>The endpoints used by this proxy.</returns> |
| | 201 | | Endpoint[] ice_getEndpoints(); |
| | 202 | |
|
| | 203 | | /// <summary> |
| | 204 | | /// Creates a new proxy that is identical to this proxy, except for the endpoints. |
| | 205 | | /// </summary> |
| | 206 | | /// <param name="newEndpoints">The endpoints for the new proxy.</param> |
| | 207 | | /// <returns>The proxy with the new endpoints.</returns> |
| | 208 | | ObjectPrx ice_endpoints(Endpoint[] newEndpoints); |
| | 209 | |
|
| | 210 | | /// <summary> |
| | 211 | | /// Gets the locator cache timeout of this proxy. |
| | 212 | | /// </summary> |
| | 213 | | /// <returns>The locator cache timeout value.</returns> |
| | 214 | | TimeSpan ice_getLocatorCacheTimeout(); |
| | 215 | |
|
| | 216 | | /// <summary> |
| | 217 | | /// Creates a new proxy that is identical to this proxy, except for the locator cache timeout. |
| | 218 | | /// </summary> |
| | 219 | | /// <param name="newTimeout">The new locator cache timeout (in seconds).</param> |
| | 220 | | ObjectPrx ice_locatorCacheTimeout(int newTimeout); |
| | 221 | |
|
| | 222 | | /// <summary> |
| | 223 | | /// Creates a new proxy that is identical to this proxy, except for the locator cache timeout. |
| | 224 | | /// </summary> |
| | 225 | | /// <param name="newTimeout">The new locator cache timeout.</param> |
| | 226 | | ObjectPrx ice_locatorCacheTimeout(TimeSpan newTimeout); |
| | 227 | |
|
| | 228 | | /// <summary> |
| | 229 | | /// Creates a new proxy that is identical to this proxy, except for the invocation timeout. |
| | 230 | | /// </summary> |
| | 231 | | /// <param name="newTimeout">The new invocation timeout (in milliseconds).</param> |
| | 232 | | ObjectPrx ice_invocationTimeout(int newTimeout); |
| | 233 | |
|
| | 234 | | /// <summary> |
| | 235 | | /// Creates a new proxy that is identical to this proxy, except for the invocation timeout. |
| | 236 | | /// </summary> |
| | 237 | | /// <param name="newTimeout">The new invocation timeout.</param> |
| | 238 | | ObjectPrx ice_invocationTimeout(TimeSpan newTimeout); |
| | 239 | |
|
| | 240 | | /// <summary> |
| | 241 | | /// Gets the invocation timeout of this proxy. |
| | 242 | | /// </summary> |
| | 243 | | /// <returns>The invocation timeout value.</returns> |
| | 244 | | TimeSpan ice_getInvocationTimeout(); |
| | 245 | |
|
| | 246 | | /// <summary> |
| | 247 | | /// Returns whether this proxy caches connections. |
| | 248 | | /// </summary> |
| | 249 | | /// <returns>True if this proxy caches connections; false, otherwise.</returns> |
| | 250 | | bool ice_isConnectionCached(); |
| | 251 | |
|
| | 252 | | /// <summary> |
| | 253 | | /// Creates a new proxy that is identical to this proxy, except for connection caching. |
| | 254 | | /// </summary> |
| | 255 | | /// <param name="newCache">True if the new proxy should cache connections; false, otherwise.</param> |
| | 256 | | /// <returns>The new proxy with the specified caching policy.</returns> |
| | 257 | | ObjectPrx ice_connectionCached(bool newCache); |
| | 258 | |
|
| | 259 | | /// <summary> |
| | 260 | | /// Returns how this proxy selects endpoints (randomly or ordered). |
| | 261 | | /// </summary> |
| | 262 | | /// <returns>The endpoint selection policy.</returns> |
| | 263 | | EndpointSelectionType ice_getEndpointSelection(); |
| | 264 | |
|
| | 265 | | /// <summary> |
| | 266 | | /// Creates a new proxy that is identical to this proxy, except for the endpoint selection policy. |
| | 267 | | /// </summary> |
| | 268 | | /// <param name="newType">The new endpoint selection policy.</param> |
| | 269 | | /// <returns>The new proxy with the specified endpoint selection policy.</returns> |
| | 270 | | ObjectPrx ice_endpointSelection(EndpointSelectionType newType); |
| | 271 | |
|
| | 272 | | /// <summary> |
| | 273 | | /// Creates a new proxy that is identical to this proxy, except for the encoding used to marshal |
| | 274 | | /// parameters. |
| | 275 | | /// </summary> |
| | 276 | | /// <param name="encodingVersion">The encoding version to use to marshal requests parameters.</param> |
| | 277 | | /// <returns>The new proxy with the specified encoding version.</returns> |
| | 278 | | ObjectPrx ice_encodingVersion(EncodingVersion encodingVersion); |
| | 279 | |
|
| | 280 | | /// <summary>Gets the encoding version used to marshal requests parameters.</summary> |
| | 281 | | /// <returns>The encoding version.</returns> |
| | 282 | | EncodingVersion ice_getEncodingVersion(); |
| | 283 | |
|
| | 284 | | /// <summary> |
| | 285 | | /// Gets the router for this proxy. |
| | 286 | | /// </summary> |
| | 287 | | /// <returns>The router for the proxy. If no router is configured for the proxy, the return value |
| | 288 | | /// is null.</returns> |
| | 289 | | RouterPrx? ice_getRouter(); |
| | 290 | |
|
| | 291 | | /// <summary> |
| | 292 | | /// Creates a new proxy that is identical to this proxy, except for the router. |
| | 293 | | /// </summary> |
| | 294 | | /// <param name="router">The router for the new proxy.</param> |
| | 295 | | /// <returns>The new proxy with the specified router.</returns> |
| | 296 | | ObjectPrx ice_router(RouterPrx? router); |
| | 297 | |
|
| | 298 | | /// <summary> |
| | 299 | | /// Gets the locator for this proxy. |
| | 300 | | /// </summary> |
| | 301 | | /// <returns>The locator for this proxy. If no locator is configured, the return value is null.</returns> |
| | 302 | | LocatorPrx? ice_getLocator(); |
| | 303 | |
|
| | 304 | | /// <summary> |
| | 305 | | /// Creates a new proxy that is identical to this proxy, except for the locator. |
| | 306 | | /// </summary> |
| | 307 | | /// <param name="locator">The locator for the new proxy.</param> |
| | 308 | | /// <returns>The new proxy with the specified locator.</returns> |
| | 309 | | ObjectPrx ice_locator(LocatorPrx? locator); |
| | 310 | |
|
| | 311 | | /// <summary> |
| | 312 | | /// Returns whether this proxy uses collocation optimization. |
| | 313 | | /// </summary> |
| | 314 | | /// <returns>True if the proxy uses collocation optimization; false, otherwise.</returns> |
| | 315 | | bool ice_isCollocationOptimized(); |
| | 316 | |
|
| | 317 | | /// <summary> |
| | 318 | | /// Creates a new proxy that is identical to this proxy, except for collocation optimization. |
| | 319 | | /// </summary> |
| | 320 | | /// <param name="collocated">True if the new proxy enables collocation optimization; false, otherwise.</param> |
| | 321 | | /// <returns>The new proxy the specified collocation optimization.</returns> |
| | 322 | | ObjectPrx ice_collocationOptimized(bool collocated); |
| | 323 | |
|
| | 324 | | /// <summary> |
| | 325 | | /// Creates a new proxy that is identical to this proxy, but uses twoway invocations. |
| | 326 | | /// </summary> |
| | 327 | | /// <returns>A new proxy that uses twoway invocations.</returns> |
| | 328 | | ObjectPrx ice_twoway(); |
| | 329 | |
|
| | 330 | | /// <summary> |
| | 331 | | /// Returns whether this proxy uses twoway invocations. |
| | 332 | | /// </summary> |
| | 333 | | /// <returns>True if this proxy uses twoway invocations; false, otherwise.</returns> |
| | 334 | | bool ice_isTwoway(); |
| | 335 | |
|
| | 336 | | /// <summary> |
| | 337 | | /// Creates a new proxy that is identical to this proxy, but uses oneway invocations. |
| | 338 | | /// </summary> |
| | 339 | | /// <returns>A new proxy that uses oneway invocations.</returns> |
| | 340 | | ObjectPrx ice_oneway(); |
| | 341 | |
|
| | 342 | | /// <summary> |
| | 343 | | /// Returns whether this proxy uses oneway invocations. |
| | 344 | | /// </summary> |
| | 345 | | /// <returns>True if this proxy uses oneway invocations; false, otherwise.</returns> |
| | 346 | | bool ice_isOneway(); |
| | 347 | |
|
| | 348 | | /// <summary> |
| | 349 | | /// Creates a new proxy that is identical to this proxy, but uses batch oneway invocations. |
| | 350 | | /// </summary> |
| | 351 | | /// <returns>A new proxy that uses batch oneway invocations.</returns> |
| | 352 | | ObjectPrx ice_batchOneway(); |
| | 353 | |
|
| | 354 | | /// <summary> |
| | 355 | | /// Returns whether this proxy uses batch oneway invocations. |
| | 356 | | /// </summary> |
| | 357 | | /// <returns>True if this proxy uses batch oneway invocations; false, otherwise.</returns> |
| | 358 | | bool ice_isBatchOneway(); |
| | 359 | |
|
| | 360 | | /// <summary> |
| | 361 | | /// Creates a new proxy that is identical to this proxy, but uses datagram invocations. |
| | 362 | | /// </summary> |
| | 363 | | /// <returns>A new proxy that uses datagram invocations.</returns> |
| | 364 | | ObjectPrx ice_datagram(); |
| | 365 | |
|
| | 366 | | /// <summary> |
| | 367 | | /// Returns whether this proxy uses datagram invocations. |
| | 368 | | /// </summary> |
| | 369 | | /// <returns>True if this proxy uses datagram invocations; false, otherwise.</returns> |
| | 370 | | bool ice_isDatagram(); |
| | 371 | |
|
| | 372 | | /// <summary> |
| | 373 | | /// Creates a new proxy that is identical to this proxy, but uses batch datagram invocations. |
| | 374 | | /// </summary> |
| | 375 | | /// <returns>A new proxy that uses batch datagram invocations.</returns> |
| | 376 | | ObjectPrx ice_batchDatagram(); |
| | 377 | |
|
| | 378 | | /// <summary> |
| | 379 | | /// Returns whether this proxy uses batch datagram invocations. |
| | 380 | | /// </summary> |
| | 381 | | /// <returns>True if this proxy uses batch datagram invocations; false, otherwise.</returns> |
| | 382 | | bool ice_isBatchDatagram(); |
| | 383 | |
|
| | 384 | | /// <summary> |
| | 385 | | /// Creates a new proxy that is identical to this proxy, except for compression. |
| | 386 | | /// </summary> |
| | 387 | | /// <param name="compress">True enables compression for the new proxy; false disables compression.</param> |
| | 388 | | /// <returns>A new proxy with the specified compression setting.</returns> |
| | 389 | | ObjectPrx ice_compress(bool compress); |
| | 390 | |
|
| | 391 | | /// <summary> |
| | 392 | | /// Obtains the compression override setting of this proxy. |
| | 393 | | /// </summary> |
| | 394 | | /// <returns>The compression override setting. If no optional value is present, no override is |
| | 395 | | /// set. Otherwise, true if compression is enabled, false otherwise.</returns> |
| | 396 | | bool? ice_getCompress(); |
| | 397 | |
|
| | 398 | | /// <summary> |
| | 399 | | /// Creates a new proxy that is identical to this proxy, except for its connection ID. |
| | 400 | | /// </summary> |
| | 401 | | /// <param name="connectionId">The connection ID for the new proxy. An empty string removes the |
| | 402 | | /// connection ID.</param> |
| | 403 | | /// <returns>A new proxy with the specified connection ID.</returns> |
| | 404 | | ObjectPrx ice_connectionId(string connectionId); |
| | 405 | |
|
| | 406 | | /// <summary> |
| | 407 | | /// Gets the connection id of this proxy. |
| | 408 | | /// </summary> |
| | 409 | | /// <returns>The connection id.</returns> |
| | 410 | | string ice_getConnectionId(); |
| | 411 | |
|
| | 412 | | /// <summary> |
| | 413 | | /// Returns a proxy that is identical to this proxy, except it's a fixed proxy bound |
| | 414 | | /// the given connection. |
| | 415 | | /// </summary> |
| | 416 | | /// <param name="connection">The fixed proxy connection.</param> |
| | 417 | | /// <returns>A fixed proxy bound to the given connection.</returns> |
| | 418 | | ObjectPrx ice_fixed(Ice.Connection connection); |
| | 419 | |
|
| | 420 | | /// <summary> |
| | 421 | | /// Returns whether this proxy is a fixed proxy. |
| | 422 | | /// </summary> |
| | 423 | | /// <returns>True if this is a fixed proxy, false otherwise. |
| | 424 | | /// </returns> |
| | 425 | | bool ice_isFixed(); |
| | 426 | |
|
| | 427 | | /// <summary> |
| | 428 | | /// Gets the connection to the server that hosts the target object. This method establishes the connection to the |
| | 429 | | /// server if it is not already established. |
| | 430 | | /// </summary> |
| | 431 | | /// <returns>The connection to the server that hosts the target object, or null when this proxy uses collocation |
| | 432 | | /// optimization to communicate with the target object.</returns> |
| | 433 | | Connection? ice_getConnection(); |
| | 434 | |
|
| | 435 | | /// <summary> |
| | 436 | | /// Gets the connection to the server that hosts the target object. This method establishes the connection to the |
| | 437 | | /// server if it is not already established. |
| | 438 | | /// </summary> |
| | 439 | | /// <param name="progress">Sent progress provider.</param> |
| | 440 | | /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> |
| | 441 | | /// <returns>The connection to the server that hosts the target object, or null when this proxy uses collocation |
| | 442 | | /// optimization to communicate with the target object.</returns> |
| | 443 | | Task<Connection?> ice_getConnectionAsync(IProgress<bool>? progress = null, CancellationToken cancel = default); |
| | 444 | |
|
| | 445 | | /// <summary> |
| | 446 | | /// Gets the cached Connection for this proxy. If the proxy does not yet have an established |
| | 447 | | /// connection, it does not attempt to create a connection. |
| | 448 | | /// </summary> |
| | 449 | | /// <returns>The cached Connection for this proxy (null if the proxy does not have |
| | 450 | | /// an established connection).</returns> |
| | 451 | | Connection? ice_getCachedConnection(); |
| | 452 | |
|
| | 453 | | /// <summary> |
| | 454 | | /// Flushes any pending batched requests for this proxy. The call blocks until the flush is complete. |
| | 455 | | /// </summary> |
| | 456 | | void ice_flushBatchRequests(); |
| | 457 | |
|
| | 458 | | /// <summary> |
| | 459 | | /// Asynchronously flushes any pending batched requests for this proxy. |
| | 460 | | /// </summary> |
| | 461 | | /// <param name="progress">Sent progress provider.</param> |
| | 462 | | /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> |
| | 463 | | /// <returns>The task object representing the asynchronous operation.</returns> |
| | 464 | | Task ice_flushBatchRequestsAsync( |
| | 465 | | IProgress<bool>? progress = null, |
| | 466 | | CancellationToken cancel = default); |
| | 467 | |
|
| | 468 | | /// <summary> |
| | 469 | | /// Write a proxy to the output stream. |
| | 470 | | /// </summary> |
| | 471 | | /// <param name="os">Output stream object to write the proxy.</param> |
| | 472 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | 473 | | void iceWrite(OutputStream os); |
| | 474 | |
|
| | 475 | | /// <summary> |
| | 476 | | /// Returns a scheduler object that uses the Ice thread pool. |
| | 477 | | /// </summary> |
| | 478 | | /// <returns>The task scheduler object.</returns> |
| | 479 | | TaskScheduler ice_scheduler(); |
| | 480 | | } |
| | 481 | |
|
| | 482 | | /// <summary> |
| | 483 | | /// Represent the result of the ice_invokeAsync operation. |
| | 484 | | /// </summary> |
| | 485 | | public record struct Object_Ice_invokeResult(bool returnValue, byte[] outEncaps); |
| | 486 | |
|
| | 487 | | /// <summary> |
| | 488 | | /// Base class of all object proxies. |
| | 489 | | /// </summary> |
| | 490 | | public abstract class ObjectPrxHelperBase : ObjectPrx |
| | 491 | | { |
| | 492 | | public static bool operator ==(ObjectPrxHelperBase? lhs, ObjectPrxHelperBase? rhs) => |
| 0 | 493 | | lhs is not null ? lhs.Equals(rhs) : rhs is null; |
| | 494 | |
|
| 0 | 495 | | public static bool operator !=(ObjectPrxHelperBase? lhs, ObjectPrxHelperBase? rhs) => !(lhs == rhs); |
| | 496 | |
|
| | 497 | | /// <summary> |
| | 498 | | /// Returns whether this proxy equals the passed object. Two proxies are equal if they are equal in all |
| | 499 | | /// respects, that is, if their object identity, endpoints timeout settings, and so on are all equal. |
| | 500 | | /// </summary> |
| | 501 | | /// <param name="other">The proxy to compare this proxy with.</param> |
| | 502 | | /// <returns>True if this proxy is equal to r; false, otherwise.</returns> |
| | 503 | | public bool Equals(ObjectPrx? other) => |
| 1 | 504 | | other is not null && _reference == ((ObjectPrxHelperBase)other)._reference; |
| | 505 | |
|
| 1 | 506 | | public override bool Equals(object? obj) => Equals(obj as ObjectPrx); |
| | 507 | |
|
| | 508 | | /// <summary> |
| | 509 | | /// Returns a hash code for this proxy. |
| | 510 | | /// </summary> |
| | 511 | | /// <returns>The hash code.</returns> |
| 1 | 512 | | public override int GetHashCode() => _reference.GetHashCode(); |
| | 513 | |
|
| | 514 | | /// <summary> |
| | 515 | | /// Gets the communicator that created this proxy. |
| | 516 | | /// </summary> |
| | 517 | | /// <returns>The communicator that created this proxy.</returns> |
| 1 | 518 | | public Communicator ice_getCommunicator() => _reference.getCommunicator(); |
| | 519 | |
|
| | 520 | | /// <summary> |
| | 521 | | /// Gets the stringified form of this proxy. |
| | 522 | | /// </summary> |
| | 523 | | /// <returns>The stringified proxy.</returns> |
| 1 | 524 | | public override string ToString() => _reference.ToString(); |
| | 525 | |
|
| | 526 | | /// <summary> |
| | 527 | | /// Tests whether this object supports a specific Slice interface. |
| | 528 | | /// </summary> |
| | 529 | | /// <param name="id">The type ID of the Slice interface to test against.</param> |
| | 530 | | /// <param name="context">The request context.</param> |
| | 531 | | /// <returns>True if the target object has the interface specified by id or derives |
| | 532 | | /// from the interface specified by id.</returns> |
| | 533 | | public bool ice_isA(string id, Dictionary<string, string>? context = null) |
| | 534 | | { |
| | 535 | | try |
| | 536 | | { |
| 1 | 537 | | return iceI_ice_isAAsync(id, context, synchronous: true, progress: null, CancellationToken.None).Result; |
| | 538 | | } |
| 1 | 539 | | catch (AggregateException ex) |
| | 540 | | { |
| 1 | 541 | | throw ex.InnerException!; |
| | 542 | | } |
| 1 | 543 | | } |
| | 544 | |
|
| | 545 | | /// <summary> |
| | 546 | | /// Tests whether this object supports a specific Slice interface. |
| | 547 | | /// </summary> |
| | 548 | | /// <param name="id">The type ID of the Slice interface to test against.</param> |
| | 549 | | /// <param name="context">The request context.</param> |
| | 550 | | /// <param name="progress">Sent progress provider.</param> |
| | 551 | | /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> |
| | 552 | | /// <returns>The task object representing the asynchronous operation.</returns> |
| | 553 | | public Task<bool> ice_isAAsync( |
| | 554 | | string id, |
| | 555 | | Dictionary<string, string>? context = null, |
| | 556 | | IProgress<bool>? progress = null, |
| 1 | 557 | | CancellationToken cancel = default) => iceI_ice_isAAsync(id, context, synchronous: false, progress, cancel); |
| | 558 | |
|
| | 559 | | private Task<bool> |
| | 560 | | iceI_ice_isAAsync( |
| | 561 | | string id, |
| | 562 | | Dictionary<string, string>? context, |
| | 563 | | bool synchronous, |
| | 564 | | IProgress<bool>? progress, |
| | 565 | | CancellationToken cancel) |
| | 566 | | { |
| 1 | 567 | | iceCheckTwowayOnly(_ice_isA_name); |
| 1 | 568 | | var completed = new OperationTaskCompletionCallback<bool>(progress, cancel); |
| 1 | 569 | | iceI_ice_isA(id, context, completed, synchronous); |
| 1 | 570 | | return completed.Task; |
| | 571 | | } |
| | 572 | |
|
| | 573 | | private const string _ice_isA_name = "ice_isA"; |
| | 574 | |
|
| | 575 | | private void iceI_ice_isA( |
| | 576 | | string id, |
| | 577 | | Dictionary<string, string>? context, |
| | 578 | | OutgoingAsyncCompletionCallback completed, |
| | 579 | | bool synchronous) |
| | 580 | | { |
| 1 | 581 | | iceCheckAsyncTwowayOnly(_ice_isA_name); |
| 1 | 582 | | getOutgoingAsync<bool>(completed).invoke( |
| 1 | 583 | | _ice_isA_name, |
| 1 | 584 | | OperationMode.Idempotent, |
| 1 | 585 | | FormatType.CompactFormat, |
| 1 | 586 | | context, |
| 1 | 587 | | synchronous, |
| 1 | 588 | | (OutputStream os) => os.writeString(id), |
| 1 | 589 | | null, |
| 1 | 590 | | (InputStream iss) => iss.readBool()); |
| 1 | 591 | | } |
| | 592 | |
|
| | 593 | | /// <summary> |
| | 594 | | /// Tests whether the target object of this proxy can be reached. |
| | 595 | | /// </summary> |
| | 596 | | /// <param name="context">The request context.</param> |
| | 597 | | public void ice_ping(Dictionary<string, string>? context = null) |
| | 598 | | { |
| | 599 | | try |
| | 600 | | { |
| 1 | 601 | | iceI_ice_pingAsync(context, synchronous: true, progress: null, CancellationToken.None).Wait(); |
| 1 | 602 | | } |
| 1 | 603 | | catch (AggregateException ex) |
| | 604 | | { |
| 1 | 605 | | throw ex.InnerException!; |
| | 606 | | } |
| 1 | 607 | | } |
| | 608 | |
|
| | 609 | | /// <summary> |
| | 610 | | /// Tests whether the target object of this proxy can be reached. |
| | 611 | | /// </summary> |
| | 612 | | /// <param name="context">The request context.</param> |
| | 613 | | /// <param name="progress">Sent progress provider.</param> |
| | 614 | | /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> |
| | 615 | | /// <returns>The task object representing the asynchronous operation.</returns> |
| | 616 | | public Task ice_pingAsync( |
| | 617 | | Dictionary<string, string>? context = null, |
| | 618 | | IProgress<bool>? progress = null, |
| 1 | 619 | | CancellationToken cancel = default) => iceI_ice_pingAsync(context, synchronous: false, progress, cancel); |
| | 620 | |
|
| | 621 | | private Task |
| | 622 | | iceI_ice_pingAsync( |
| | 623 | | Dictionary<string, string>? context, |
| | 624 | | bool synchronous, |
| | 625 | | IProgress<bool>? progress, |
| | 626 | | CancellationToken cancel) |
| | 627 | | { |
| 1 | 628 | | var completed = new OperationTaskCompletionCallback<object>(progress, cancel); |
| 1 | 629 | | iceI_ice_ping(context, completed, synchronous); |
| 1 | 630 | | return completed.Task; |
| | 631 | | } |
| | 632 | |
|
| | 633 | | private const string _ice_ping_name = "ice_ping"; |
| | 634 | |
|
| | 635 | | private void iceI_ice_ping( |
| | 636 | | Dictionary<string, string>? context, |
| | 637 | | OutgoingAsyncCompletionCallback completed, |
| | 638 | | bool synchronous) |
| | 639 | | { |
| 1 | 640 | | getOutgoingAsync<object>(completed).invoke( |
| 1 | 641 | | _ice_ping_name, |
| 1 | 642 | | OperationMode.Idempotent, |
| 1 | 643 | | FormatType.CompactFormat, |
| 1 | 644 | | context, |
| 1 | 645 | | synchronous); |
| 1 | 646 | | } |
| | 647 | |
|
| | 648 | | /// <summary> |
| | 649 | | /// Gets the Slice type IDs of the interfaces supported by the target object of this proxy. |
| | 650 | | /// </summary> |
| | 651 | | /// <param name="context">The request context.</param> |
| | 652 | | /// <returns>The Slice type IDs of the interfaces supported by the target object, in alphabetical order. |
| | 653 | | /// </returns> |
| | 654 | | public string[] ice_ids(Dictionary<string, string>? context = null) |
| | 655 | | { |
| | 656 | | try |
| | 657 | | { |
| 1 | 658 | | return iceI_ice_idsAsync(context, synchronous: true, progress: null, CancellationToken.None).Result; |
| | 659 | | } |
| 1 | 660 | | catch (AggregateException ex) |
| | 661 | | { |
| 1 | 662 | | throw ex.InnerException!; |
| | 663 | | } |
| 1 | 664 | | } |
| | 665 | |
|
| | 666 | | /// <summary> |
| | 667 | | /// Gets the Slice type IDs of the interfaces supported by the target object of this proxy. |
| | 668 | | /// </summary> |
| | 669 | | /// <param name="context">The request context.</param> |
| | 670 | | /// <param name="progress">Sent progress provider.</param> |
| | 671 | | /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> |
| | 672 | | /// <returns>The task object representing the asynchronous operation.</returns> |
| | 673 | | public Task<string[]> |
| | 674 | | ice_idsAsync( |
| | 675 | | Dictionary<string, string>? context = null, |
| | 676 | | IProgress<bool>? progress = null, |
| 1 | 677 | | CancellationToken cancel = default) => iceI_ice_idsAsync(context, synchronous: false, progress, cancel); |
| | 678 | |
|
| | 679 | | private Task<string[]> iceI_ice_idsAsync( |
| | 680 | | Dictionary<string, string>? context, |
| | 681 | | bool synchronous, |
| | 682 | | IProgress<bool>? progress, |
| | 683 | | CancellationToken cancel) |
| | 684 | | { |
| 1 | 685 | | iceCheckTwowayOnly(_ice_ids_name); |
| 1 | 686 | | var completed = new OperationTaskCompletionCallback<string[]>(progress, cancel); |
| 1 | 687 | | iceI_ice_ids(context, completed, synchronous); |
| 1 | 688 | | return completed.Task; |
| | 689 | | } |
| | 690 | |
|
| | 691 | | private const string _ice_ids_name = "ice_ids"; |
| | 692 | |
|
| | 693 | | private void iceI_ice_ids( |
| | 694 | | Dictionary<string, string>? context, |
| | 695 | | OutgoingAsyncCompletionCallback completed, |
| | 696 | | bool synchronous) |
| | 697 | | { |
| 1 | 698 | | iceCheckAsyncTwowayOnly(_ice_ids_name); |
| 1 | 699 | | getOutgoingAsync<string[]>(completed).invoke( |
| 1 | 700 | | _ice_ids_name, |
| 1 | 701 | | OperationMode.Idempotent, |
| 1 | 702 | | FormatType.CompactFormat, |
| 1 | 703 | | context, |
| 1 | 704 | | synchronous, |
| 1 | 705 | | read: (InputStream iss) => iss.readStringSeq()); |
| 1 | 706 | | } |
| | 707 | |
|
| | 708 | | /// <summary> |
| | 709 | | /// Gets the Slice type ID of the most-derived interface supported by the target object of this proxy. |
| | 710 | | /// </summary> |
| | 711 | | /// <param name="context">The request context.</param> |
| | 712 | | /// <returns>The Slice type ID of the most-derived interface.</returns> |
| | 713 | | public string ice_id(Dictionary<string, string>? context = null) |
| | 714 | | { |
| | 715 | | try |
| | 716 | | { |
| 1 | 717 | | return iceI_ice_idAsync(context, synchronous: true, progress: null, CancellationToken.None).Result; |
| | 718 | | } |
| 0 | 719 | | catch (AggregateException ex) |
| | 720 | | { |
| 0 | 721 | | throw ex.InnerException!; |
| | 722 | | } |
| 1 | 723 | | } |
| | 724 | |
|
| | 725 | | /// <summary> |
| | 726 | | /// Gets the Slice type ID of the most-derived interface supported by the target object of this proxy. |
| | 727 | | /// </summary> |
| | 728 | | /// <param name="context">The request context.</param> |
| | 729 | | /// <param name="progress">Sent progress provider.</param> |
| | 730 | | /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> |
| | 731 | | /// <returns>The task object representing the asynchronous operation.</returns> |
| | 732 | | public Task<string> ice_idAsync( |
| | 733 | | Dictionary<string, string>? context = null, |
| | 734 | | IProgress<bool>? progress = null, |
| 1 | 735 | | CancellationToken cancel = default) => iceI_ice_idAsync(context, synchronous: false, progress, cancel); |
| | 736 | |
|
| | 737 | | private Task<string> |
| | 738 | | iceI_ice_idAsync( |
| | 739 | | Dictionary<string, string>? context, |
| | 740 | | bool synchronous, |
| | 741 | | IProgress<bool>? progress, |
| | 742 | | CancellationToken cancel) |
| | 743 | | { |
| 1 | 744 | | iceCheckTwowayOnly(_ice_id_name); |
| 1 | 745 | | var completed = new OperationTaskCompletionCallback<string>(progress, cancel); |
| 1 | 746 | | iceI_ice_id(context, completed, synchronous); |
| 1 | 747 | | return completed.Task; |
| | 748 | | } |
| | 749 | |
|
| | 750 | | private const string _ice_id_name = "ice_id"; |
| | 751 | |
|
| | 752 | | private void iceI_ice_id( |
| | 753 | | Dictionary<string, string>? context, |
| | 754 | | OutgoingAsyncCompletionCallback completed, |
| | 755 | | bool synchronous) |
| | 756 | | { |
| 1 | 757 | | getOutgoingAsync<string>(completed).invoke( |
| 1 | 758 | | _ice_id_name, |
| 1 | 759 | | OperationMode.Idempotent, |
| 1 | 760 | | FormatType.CompactFormat, |
| 1 | 761 | | context, |
| 1 | 762 | | synchronous, |
| 1 | 763 | | read: (InputStream iss) => iss.readString()); |
| 1 | 764 | | } |
| | 765 | |
|
| | 766 | | /// <summary> |
| | 767 | | /// Invokes an operation dynamically. |
| | 768 | | /// </summary> |
| | 769 | | /// <param name="operation">The name of the operation to invoke.</param> |
| | 770 | | /// <param name="mode">The operation mode (normal or idempotent).</param> |
| | 771 | | /// <param name="inEncaps">The encoded in-parameters for the operation.</param> |
| | 772 | | /// <param name="outEncaps">The encoded out-parameters and return value |
| | 773 | | /// for the operation. The return value follows any out-parameters.</param> |
| | 774 | | /// <param name="context">The request context.</param> |
| | 775 | | /// <returns>If the operation completed successfully, the return value |
| | 776 | | /// is true. If the operation raises a user exception, |
| | 777 | | /// the return value is false; in this case, outEncaps |
| | 778 | | /// contains the encoded user exception. If the operation raises a run-time exception, |
| | 779 | | /// it throws it directly.</returns> |
| | 780 | | public bool ice_invoke( |
| | 781 | | string operation, |
| | 782 | | OperationMode mode, |
| | 783 | | byte[] inEncaps, |
| | 784 | | out byte[] outEncaps, |
| | 785 | | Dictionary<string, string>? context = null) |
| | 786 | | { |
| | 787 | | try |
| | 788 | | { |
| 1 | 789 | | Object_Ice_invokeResult result = iceI_ice_invokeAsync( |
| 1 | 790 | | operation, |
| 1 | 791 | | mode, |
| 1 | 792 | | inEncaps, |
| 1 | 793 | | context, |
| 1 | 794 | | synchronous: true, |
| 1 | 795 | | progress: null, |
| 1 | 796 | | CancellationToken.None).Result; |
| 1 | 797 | | outEncaps = result.outEncaps; |
| 1 | 798 | | return result.returnValue; |
| | 799 | | } |
| 1 | 800 | | catch (AggregateException ex) |
| | 801 | | { |
| 1 | 802 | | throw ex.InnerException!; |
| | 803 | | } |
| 1 | 804 | | } |
| | 805 | |
|
| | 806 | | /// <summary> |
| | 807 | | /// Invokes an operation dynamically. |
| | 808 | | /// </summary> |
| | 809 | | /// <param name="operation">The name of the operation to invoke.</param> |
| | 810 | | /// <param name="mode">The operation mode (normal or idempotent).</param> |
| | 811 | | /// <param name="inEncaps">The encoded in-parameters for the operation.</param> |
| | 812 | | /// <param name="context">The request context.</param> |
| | 813 | | /// <param name="progress">Sent progress provider.</param> |
| | 814 | | /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> |
| | 815 | | /// <returns>The task object representing the asynchronous operation.</returns> |
| | 816 | | public Task<Object_Ice_invokeResult> |
| | 817 | | ice_invokeAsync( |
| | 818 | | string operation, |
| | 819 | | OperationMode mode, |
| | 820 | | byte[] inEncaps, |
| | 821 | | Dictionary<string, string>? context = null, |
| | 822 | | IProgress<bool>? progress = null, |
| | 823 | | CancellationToken cancel = default) => |
| 1 | 824 | | iceI_ice_invokeAsync(operation, mode, inEncaps, context, synchronous: false, progress, cancel); |
| | 825 | |
|
| | 826 | | private Task<Object_Ice_invokeResult> |
| | 827 | | iceI_ice_invokeAsync( |
| | 828 | | string operation, |
| | 829 | | OperationMode mode, |
| | 830 | | byte[] inEncaps, |
| | 831 | | Dictionary<string, string>? context, |
| | 832 | | bool synchronous, |
| | 833 | | IProgress<bool>? progress, |
| | 834 | | CancellationToken cancel) |
| | 835 | | { |
| 1 | 836 | | var completed = new InvokeTaskCompletionCallback(progress, cancel); |
| 1 | 837 | | iceI_ice_invoke(operation, mode, inEncaps, context, completed, synchronous); |
| 1 | 838 | | return completed.Task; |
| | 839 | | } |
| | 840 | |
|
| | 841 | | private void iceI_ice_invoke( |
| | 842 | | string operation, |
| | 843 | | OperationMode mode, |
| | 844 | | byte[] inEncaps, |
| | 845 | | Dictionary<string, string>? context, |
| | 846 | | OutgoingAsyncCompletionCallback completed, |
| 1 | 847 | | bool synchronous) => getInvokeOutgoingAsync(completed).invoke(operation, mode, inEncaps, context, synchronous); |
| | 848 | |
|
| | 849 | | /// <summary> |
| | 850 | | /// Gets the identity embedded in this proxy. |
| | 851 | | /// </summary> |
| | 852 | | /// <returns>The identity of the target object.</returns> |
| 1 | 853 | | public Identity ice_getIdentity() => _reference.getIdentity() with { }; |
| | 854 | |
|
| | 855 | | /// <summary> |
| | 856 | | /// Creates a new proxy that is identical to this proxy, except for the proxy identity. |
| | 857 | | /// </summary> |
| | 858 | | /// <param name="newIdentity">The identity for the new proxy.</param> |
| | 859 | | /// <returns>The new proxy with the specified identity.</returns> |
| | 860 | | /// <exception cref="ArgumentException">If the name of the new identity is empty.</exception> |
| | 861 | | public ObjectPrx ice_identity(Identity newIdentity) |
| | 862 | | { |
| 1 | 863 | | if (newIdentity.name.Length == 0) |
| | 864 | | { |
| 0 | 865 | | throw new ArgumentException("The name of an Ice object identity cannot be empty.", nameof(newIdentity)); |
| | 866 | | } |
| 1 | 867 | | if (newIdentity == _reference.getIdentity()) |
| | 868 | | { |
| 1 | 869 | | return this; |
| | 870 | | } |
| | 871 | | else |
| | 872 | | { |
| 1 | 873 | | return new ObjectPrxHelper(_reference.changeIdentity(newIdentity)); |
| | 874 | | } |
| | 875 | | } |
| | 876 | |
|
| | 877 | | /// <summary> |
| | 878 | | /// Gets the per-proxy context for this proxy. |
| | 879 | | /// </summary> |
| | 880 | | /// <returns>The per-proxy context. If the proxy does not have a per-proxy (implicit) context, the return value |
| | 881 | | /// is null.</returns> |
| 1 | 882 | | public Dictionary<string, string> ice_getContext() => new Dictionary<string, string>(_reference.getContext()); |
| | 883 | |
|
| | 884 | | /// <summary> |
| | 885 | | /// Creates a new proxy that is identical to this proxy, except for the per-proxy context. |
| | 886 | | /// </summary> |
| | 887 | | /// <param name="newContext">The context for the new proxy.</param> |
| | 888 | | /// <returns>The proxy with the new per-proxy context.</returns> |
| | 889 | | public ObjectPrx ice_context(Dictionary<string, string> newContext) => |
| 1 | 890 | | iceNewInstance(_reference.changeContext(newContext)); |
| | 891 | |
|
| | 892 | | /// <summary> |
| | 893 | | /// Gets the facet for this proxy. |
| | 894 | | /// </summary> |
| | 895 | | /// <returns>The facet for this proxy. If the proxy uses the default facet, the return value is the |
| | 896 | | /// empty string.</returns> |
| 1 | 897 | | public string ice_getFacet() => _reference.getFacet(); |
| | 898 | |
|
| | 899 | | /// <summary> |
| | 900 | | /// Creates a new proxy that is identical to this proxy, except for the facet. |
| | 901 | | /// </summary> |
| | 902 | | /// <param name="newFacet">The facet for the new proxy.</param> |
| | 903 | | /// <returns>The proxy with the new facet.</returns> |
| | 904 | | public ObjectPrx ice_facet(string newFacet) |
| | 905 | | { |
| 1 | 906 | | newFacet ??= ""; |
| | 907 | |
|
| 1 | 908 | | if (newFacet == _reference.getFacet()) |
| | 909 | | { |
| 0 | 910 | | return this; |
| | 911 | | } |
| | 912 | | else |
| | 913 | | { |
| 1 | 914 | | return new ObjectPrxHelper(_reference.changeFacet(newFacet)); |
| | 915 | | } |
| | 916 | | } |
| | 917 | |
|
| | 918 | | /// <summary> |
| | 919 | | /// Gets the adapter ID for this proxy. |
| | 920 | | /// </summary> |
| | 921 | | /// <returns>The adapter ID. If the proxy does not have an adapter ID, the return value is the |
| | 922 | | /// empty string.</returns> |
| 1 | 923 | | public string ice_getAdapterId() => _reference.getAdapterId(); |
| | 924 | |
|
| | 925 | | /// <summary> |
| | 926 | | /// Creates a new proxy that is identical to this proxy, except for the adapter ID. |
| | 927 | | /// </summary> |
| | 928 | | /// <param name="newAdapterId">The adapter ID for the new proxy.</param> |
| | 929 | | /// <returns>The new proxy with the specified adapter ID.</returns> |
| | 930 | | public ObjectPrx ice_adapterId(string newAdapterId) |
| | 931 | | { |
| 1 | 932 | | newAdapterId ??= ""; |
| | 933 | |
|
| 1 | 934 | | if (newAdapterId == _reference.getAdapterId()) |
| | 935 | | { |
| 0 | 936 | | return this; |
| | 937 | | } |
| | 938 | | else |
| | 939 | | { |
| 1 | 940 | | return iceNewInstance(_reference.changeAdapterId(newAdapterId)); |
| | 941 | | } |
| | 942 | | } |
| | 943 | |
|
| | 944 | | /// <summary> |
| | 945 | | /// Gets the endpoints used by this proxy. |
| | 946 | | /// </summary> |
| | 947 | | /// <returns>The endpoints used by this proxy.</returns> |
| 1 | 948 | | public Endpoint[] ice_getEndpoints() => (Endpoint[])_reference.getEndpoints().Clone(); |
| | 949 | |
|
| | 950 | | /// <summary> |
| | 951 | | /// Creates a new proxy that is identical to this proxy, except for the endpoints. |
| | 952 | | /// </summary> |
| | 953 | | /// <param name="newEndpoints">The endpoints for the new proxy.</param> |
| | 954 | | /// <returns>The new proxy with the specified endpoints.</returns> |
| | 955 | | public ObjectPrx ice_endpoints(Endpoint[] newEndpoints) |
| | 956 | | { |
| 1 | 957 | | newEndpoints ??= []; |
| | 958 | |
|
| 1 | 959 | | if (_reference.getEndpoints().SequenceEqual(newEndpoints)) |
| | 960 | | { |
| 1 | 961 | | return this; |
| | 962 | | } |
| | 963 | | else |
| | 964 | | { |
| 1 | 965 | | var endpoints = new EndpointI[newEndpoints.Length]; |
| 1 | 966 | | for (int i = 0; i < newEndpoints.Length; ++i) |
| | 967 | | { |
| 1 | 968 | | endpoints[i] = (EndpointI)newEndpoints[i]; |
| | 969 | | } |
| 1 | 970 | | return iceNewInstance(_reference.changeEndpoints(endpoints)); |
| | 971 | | } |
| | 972 | | } |
| | 973 | |
|
| | 974 | | /// <summary> |
| | 975 | | /// Gets the locator cache timeout of this proxy. |
| | 976 | | /// </summary> |
| | 977 | | /// <returns>The locator cache timeout value.</returns> |
| 1 | 978 | | public TimeSpan ice_getLocatorCacheTimeout() => _reference.getLocatorCacheTimeout(); |
| | 979 | |
|
| | 980 | | /// <summary> |
| | 981 | | /// Creates a new proxy that is identical to this proxy, except for the locator cache timeout. |
| | 982 | | /// </summary> |
| | 983 | | /// <param name="newTimeout">The new locator cache timeout (in seconds).</param> |
| | 984 | | /// <returns>The new proxy with the specified locator cache timeout.</returns> |
| | 985 | | public ObjectPrx ice_locatorCacheTimeout(int newTimeout) => |
| 1 | 986 | | ice_locatorCacheTimeout(TimeSpan.FromSeconds(newTimeout)); |
| | 987 | |
|
| | 988 | | /// <summary> |
| | 989 | | /// Creates a new proxy that is identical to this proxy, except for the locator cache timeout. |
| | 990 | | /// </summary> |
| | 991 | | /// <param name="newTimeout">The new locator cache timeout.</param> |
| | 992 | | /// <returns>The new proxy with the specified locator cache timeout.</returns> |
| | 993 | | public ObjectPrx ice_locatorCacheTimeout(TimeSpan newTimeout) |
| | 994 | | { |
| 1 | 995 | | if (newTimeout == _reference.getLocatorCacheTimeout()) |
| | 996 | | { |
| 1 | 997 | | return this; |
| | 998 | | } |
| | 999 | | else |
| | 1000 | | { |
| 1 | 1001 | | return iceNewInstance(_reference.changeLocatorCacheTimeout(newTimeout)); |
| | 1002 | | } |
| | 1003 | | } |
| | 1004 | |
|
| | 1005 | | /// <summary> |
| | 1006 | | /// Gets the invocation timeout of this proxy. |
| | 1007 | | /// </summary> |
| | 1008 | | /// <returns>The invocation timeout value.</returns> |
| 1 | 1009 | | public TimeSpan ice_getInvocationTimeout() => _reference.getInvocationTimeout(); |
| | 1010 | |
|
| | 1011 | | /// <summary> |
| | 1012 | | /// Creates a new proxy that is identical to this proxy, except for the invocation timeout. |
| | 1013 | | /// </summary> |
| | 1014 | | /// <param name="newTimeout">The new invocation timeout (in milliseconds).</param> |
| | 1015 | | /// <returns>The new proxy with the specified invocation timeout.</returns> |
| | 1016 | | public ObjectPrx ice_invocationTimeout(int newTimeout) => |
| 1 | 1017 | | ice_invocationTimeout(TimeSpan.FromMilliseconds(newTimeout)); |
| | 1018 | |
|
| | 1019 | | /// <summary> |
| | 1020 | | /// Creates a new proxy that is identical to this proxy, except for the invocation timeout. |
| | 1021 | | /// </summary> |
| | 1022 | | /// <param name="newTimeout">The new invocation timeout.</param> |
| | 1023 | | /// <returns>The new proxy with the specified invocation timeout.</returns> |
| | 1024 | | public ObjectPrx ice_invocationTimeout(TimeSpan newTimeout) |
| | 1025 | | { |
| 1 | 1026 | | if (newTimeout == _reference.getInvocationTimeout()) |
| | 1027 | | { |
| 1 | 1028 | | return this; |
| | 1029 | | } |
| | 1030 | | else |
| | 1031 | | { |
| 1 | 1032 | | return iceNewInstance(_reference.changeInvocationTimeout(newTimeout)); |
| | 1033 | | } |
| | 1034 | | } |
| | 1035 | |
|
| | 1036 | | /// <summary> |
| | 1037 | | /// Returns whether this proxy caches connections. |
| | 1038 | | /// </summary> |
| | 1039 | | /// <returns>True if this proxy caches connections; false, otherwise.</returns> |
| 1 | 1040 | | public bool ice_isConnectionCached() => _reference.getCacheConnection(); |
| | 1041 | |
|
| | 1042 | | /// <summary> |
| | 1043 | | /// Creates a new proxy that is identical to this proxy, except for connection caching. |
| | 1044 | | /// </summary> |
| | 1045 | | /// <param name="newCache">True if the new proxy should cache connections; false, otherwise.</param> |
| | 1046 | | /// <returns>The new proxy with the specified caching policy.</returns> |
| | 1047 | | public ObjectPrx ice_connectionCached(bool newCache) |
| | 1048 | | { |
| 1 | 1049 | | if (newCache == _reference.getCacheConnection()) |
| | 1050 | | { |
| 1 | 1051 | | return this; |
| | 1052 | | } |
| | 1053 | | else |
| | 1054 | | { |
| 1 | 1055 | | return iceNewInstance(_reference.changeCacheConnection(newCache)); |
| | 1056 | | } |
| | 1057 | | } |
| | 1058 | |
|
| | 1059 | | /// <summary> |
| | 1060 | | /// Returns how this proxy selects endpoints (randomly or ordered). |
| | 1061 | | /// </summary> |
| | 1062 | | /// <returns>The endpoint selection policy.</returns> |
| 1 | 1063 | | public EndpointSelectionType ice_getEndpointSelection() => _reference.getEndpointSelection(); |
| | 1064 | |
|
| | 1065 | | /// <summary> |
| | 1066 | | /// Creates a new proxy that is identical to this proxy, except for the endpoint selection policy. |
| | 1067 | | /// </summary> |
| | 1068 | | /// <param name="newType">The new endpoint selection policy.</param> |
| | 1069 | | /// <returns>The new proxy with the specified endpoint selection policy.</returns> |
| | 1070 | | public ObjectPrx ice_endpointSelection(EndpointSelectionType newType) |
| | 1071 | | { |
| 1 | 1072 | | if (newType == _reference.getEndpointSelection()) |
| | 1073 | | { |
| 1 | 1074 | | return this; |
| | 1075 | | } |
| | 1076 | | else |
| | 1077 | | { |
| 1 | 1078 | | return iceNewInstance(_reference.changeEndpointSelection(newType)); |
| | 1079 | | } |
| | 1080 | | } |
| | 1081 | |
|
| | 1082 | | /// <summary> |
| | 1083 | | /// Creates a new proxy that is identical to this proxy, except for the encoding used to marshal |
| | 1084 | | /// parameters. |
| | 1085 | | /// </summary> |
| | 1086 | | /// <param name="encodingVersion">The encoding version to use to marshal requests parameters.</param> |
| | 1087 | | /// <returns>The new proxy with the specified encoding version.</returns> |
| | 1088 | | public ObjectPrx ice_encodingVersion(EncodingVersion encodingVersion) |
| | 1089 | | { |
| 1 | 1090 | | if (encodingVersion == _reference.getEncoding()) |
| | 1091 | | { |
| 1 | 1092 | | return this; |
| | 1093 | | } |
| | 1094 | | else |
| | 1095 | | { |
| 1 | 1096 | | return iceNewInstance(_reference.changeEncoding(encodingVersion)); |
| | 1097 | | } |
| | 1098 | | } |
| | 1099 | |
|
| | 1100 | | /// <summary>Gets the encoding version used to marshal requests parameters.</summary> |
| | 1101 | | /// <returns>The encoding version.</returns> |
| 1 | 1102 | | public EncodingVersion ice_getEncodingVersion() => _reference.getEncoding(); |
| | 1103 | |
|
| | 1104 | | /// <summary> |
| | 1105 | | /// Gets the router for this proxy. |
| | 1106 | | /// </summary> |
| | 1107 | | /// <returns>The router for the proxy. If no router is configured for the proxy, the return value |
| | 1108 | | /// is null.</returns> |
| | 1109 | | public RouterPrx? ice_getRouter() |
| | 1110 | | { |
| 1 | 1111 | | RouterInfo ri = _reference.getRouterInfo(); |
| 1 | 1112 | | return ri?.getRouter(); |
| | 1113 | | } |
| | 1114 | |
|
| | 1115 | | /// <summary> |
| | 1116 | | /// Creates a new proxy that is identical to this proxy, except for the router. |
| | 1117 | | /// </summary> |
| | 1118 | | /// <param name="router">The router for the new proxy.</param> |
| | 1119 | | /// <returns>The new proxy with the specified router.</returns> |
| | 1120 | | public ObjectPrx ice_router(RouterPrx? router) |
| | 1121 | | { |
| 1 | 1122 | | if (router == _reference.getRouterInfo()?.getRouter()) |
| | 1123 | | { |
| 1 | 1124 | | return this; |
| | 1125 | | } |
| | 1126 | | else |
| | 1127 | | { |
| 1 | 1128 | | return iceNewInstance(_reference.changeRouter(router)); |
| | 1129 | | } |
| | 1130 | | } |
| | 1131 | |
|
| | 1132 | | /// <summary> |
| | 1133 | | /// Gets the locator for this proxy. |
| | 1134 | | /// </summary> |
| | 1135 | | /// <returns>The locator for this proxy. If no locator is configured, the return value is null.</returns> |
| | 1136 | | public LocatorPrx? ice_getLocator() |
| | 1137 | | { |
| 1 | 1138 | | LocatorInfo li = _reference.getLocatorInfo(); |
| 1 | 1139 | | return li?.getLocator(); |
| | 1140 | | } |
| | 1141 | |
|
| | 1142 | | /// <summary> |
| | 1143 | | /// Creates a new proxy that is identical to this proxy, except for the locator. |
| | 1144 | | /// </summary> |
| | 1145 | | /// <param name="locator">The locator for the new proxy.</param> |
| | 1146 | | /// <returns>The new proxy with the specified locator.</returns> |
| | 1147 | | public ObjectPrx ice_locator(LocatorPrx? locator) |
| | 1148 | | { |
| 1 | 1149 | | if (locator == _reference.getLocatorInfo()?.getLocator()) |
| | 1150 | | { |
| 1 | 1151 | | return this; |
| | 1152 | | } |
| | 1153 | | else |
| | 1154 | | { |
| 1 | 1155 | | return iceNewInstance(_reference.changeLocator(locator)); |
| | 1156 | | } |
| | 1157 | | } |
| | 1158 | |
|
| | 1159 | | /// <summary> |
| | 1160 | | /// Returns whether this proxy uses collocation optimization. |
| | 1161 | | /// </summary> |
| | 1162 | | /// <returns>True if the proxy uses collocation optimization; false, otherwise.</returns> |
| 1 | 1163 | | public bool ice_isCollocationOptimized() => _reference.getCollocationOptimized(); |
| | 1164 | |
|
| | 1165 | | /// <summary> |
| | 1166 | | /// Creates a new proxy that is identical to this proxy, except for collocation optimization. |
| | 1167 | | /// </summary> |
| | 1168 | | /// <param name="collocated">True if the new proxy enables collocation optimization; false, otherwise.</param> |
| | 1169 | | /// <returns>The new proxy the specified collocation optimization.</returns> |
| | 1170 | | public ObjectPrx ice_collocationOptimized(bool collocated) |
| | 1171 | | { |
| 1 | 1172 | | if (collocated == _reference.getCollocationOptimized()) |
| | 1173 | | { |
| 1 | 1174 | | return this; |
| | 1175 | | } |
| | 1176 | | else |
| | 1177 | | { |
| 1 | 1178 | | return iceNewInstance(_reference.changeCollocationOptimized(collocated)); |
| | 1179 | | } |
| | 1180 | | } |
| | 1181 | |
|
| | 1182 | | /// <summary> |
| | 1183 | | /// Creates a new proxy that is identical to this proxy, but uses twoway invocations. |
| | 1184 | | /// </summary> |
| | 1185 | | /// <returns>A new proxy that uses twoway invocations.</returns> |
| | 1186 | | public ObjectPrx ice_twoway() |
| | 1187 | | { |
| 1 | 1188 | | if (_reference.isTwoway) |
| | 1189 | | { |
| 1 | 1190 | | return this; |
| | 1191 | | } |
| | 1192 | | else |
| | 1193 | | { |
| 1 | 1194 | | return iceNewInstance(_reference.changeMode(Reference.Mode.ModeTwoway)); |
| | 1195 | | } |
| | 1196 | | } |
| | 1197 | |
|
| | 1198 | | /// <summary> |
| | 1199 | | /// Returns whether this proxy uses twoway invocations. |
| | 1200 | | /// </summary> |
| | 1201 | | /// <returns>True if this proxy uses twoway invocations; false, otherwise.</returns> |
| 1 | 1202 | | public bool ice_isTwoway() => _reference.isTwoway; |
| | 1203 | |
|
| | 1204 | | /// <summary> |
| | 1205 | | /// Creates a new proxy that is identical to this proxy, but uses oneway invocations. |
| | 1206 | | /// </summary> |
| | 1207 | | /// <returns>A new proxy that uses oneway invocations.</returns> |
| | 1208 | | public ObjectPrx ice_oneway() |
| | 1209 | | { |
| 1 | 1210 | | if (_reference.getMode() == Reference.Mode.ModeOneway) |
| | 1211 | | { |
| 0 | 1212 | | return this; |
| | 1213 | | } |
| | 1214 | | else |
| | 1215 | | { |
| 1 | 1216 | | return iceNewInstance(_reference.changeMode(Reference.Mode.ModeOneway)); |
| | 1217 | | } |
| | 1218 | | } |
| | 1219 | |
|
| | 1220 | | /// <summary> |
| | 1221 | | /// Returns whether this proxy uses oneway invocations. |
| | 1222 | | /// </summary> |
| | 1223 | | /// <returns>True if this proxy uses oneway invocations; false, otherwise.</returns> |
| 1 | 1224 | | public bool ice_isOneway() => _reference.getMode() == Reference.Mode.ModeOneway; |
| | 1225 | |
|
| | 1226 | | /// <summary> |
| | 1227 | | /// Creates a new proxy that is identical to this proxy, but uses batch oneway invocations. |
| | 1228 | | /// </summary> |
| | 1229 | | /// <returns>A new proxy that uses batch oneway invocations.</returns> |
| | 1230 | | public ObjectPrx ice_batchOneway() |
| | 1231 | | { |
| 1 | 1232 | | if (_reference.getMode() == Reference.Mode.ModeBatchOneway) |
| | 1233 | | { |
| 0 | 1234 | | return this; |
| | 1235 | | } |
| | 1236 | | else |
| | 1237 | | { |
| 1 | 1238 | | return iceNewInstance(_reference.changeMode(Reference.Mode.ModeBatchOneway)); |
| | 1239 | | } |
| | 1240 | | } |
| | 1241 | |
|
| | 1242 | | /// <summary> |
| | 1243 | | /// Returns whether this proxy uses batch oneway invocations. |
| | 1244 | | /// </summary> |
| | 1245 | | /// <returns>True if this proxy uses batch oneway invocations; false, otherwise.</returns> |
| 1 | 1246 | | public bool ice_isBatchOneway() => _reference.getMode() == Reference.Mode.ModeBatchOneway; |
| | 1247 | |
|
| | 1248 | | /// <summary> |
| | 1249 | | /// Creates a new proxy that is identical to this proxy, but uses datagram invocations. |
| | 1250 | | /// </summary> |
| | 1251 | | /// <returns>A new proxy that uses datagram invocations.</returns> |
| | 1252 | | public ObjectPrx ice_datagram() |
| | 1253 | | { |
| 1 | 1254 | | if (_reference.getMode() == Reference.Mode.ModeDatagram) |
| | 1255 | | { |
| 0 | 1256 | | return this; |
| | 1257 | | } |
| | 1258 | | else |
| | 1259 | | { |
| 1 | 1260 | | return iceNewInstance(_reference.changeMode(Reference.Mode.ModeDatagram)); |
| | 1261 | | } |
| | 1262 | | } |
| | 1263 | |
|
| | 1264 | | /// <summary> |
| | 1265 | | /// Returns whether this proxy uses datagram invocations. |
| | 1266 | | /// </summary> |
| | 1267 | | /// <returns>True if this proxy uses datagram invocations; false, otherwise.</returns> |
| 1 | 1268 | | public bool ice_isDatagram() => _reference.getMode() == Reference.Mode.ModeDatagram; |
| | 1269 | |
|
| | 1270 | | /// <summary> |
| | 1271 | | /// Creates a new proxy that is identical to this proxy, but uses batch datagram invocations. |
| | 1272 | | /// </summary> |
| | 1273 | | /// <returns>A new proxy that uses batch datagram invocations.</returns> |
| | 1274 | | public ObjectPrx ice_batchDatagram() |
| | 1275 | | { |
| 1 | 1276 | | if (_reference.getMode() == Reference.Mode.ModeBatchDatagram) |
| | 1277 | | { |
| 0 | 1278 | | return this; |
| | 1279 | | } |
| | 1280 | | else |
| | 1281 | | { |
| 1 | 1282 | | return iceNewInstance(_reference.changeMode(Reference.Mode.ModeBatchDatagram)); |
| | 1283 | | } |
| | 1284 | | } |
| | 1285 | |
|
| | 1286 | | /// <summary> |
| | 1287 | | /// Returns whether this proxy uses batch datagram invocations. |
| | 1288 | | /// </summary> |
| | 1289 | | /// <returns>True if this proxy uses batch datagram invocations; false, otherwise.</returns> |
| 1 | 1290 | | public bool ice_isBatchDatagram() => _reference.getMode() == Reference.Mode.ModeBatchDatagram; |
| | 1291 | |
|
| | 1292 | | /// <summary> |
| | 1293 | | /// Creates a new proxy that is identical to this proxy, except for compression. |
| | 1294 | | /// </summary> |
| | 1295 | | /// <param name="compress">True enables compression for the new proxy; false disables compression.</param> |
| | 1296 | | /// <returns>A new proxy with the specified compression setting.</returns> |
| | 1297 | | public ObjectPrx ice_compress(bool compress) |
| | 1298 | | { |
| 1 | 1299 | | if (compress == _reference.getCompress()) |
| | 1300 | | { |
| 0 | 1301 | | return this; |
| | 1302 | | } |
| | 1303 | | else |
| | 1304 | | { |
| 1 | 1305 | | return iceNewInstance(_reference.changeCompress(compress)); |
| | 1306 | | } |
| | 1307 | | } |
| | 1308 | |
|
| | 1309 | | /// <summary> |
| | 1310 | | /// Obtains the compression override setting of this proxy. |
| | 1311 | | /// </summary> |
| | 1312 | | /// <returns>The compression override setting. If no optional value is present, no override is |
| | 1313 | | /// set. Otherwise, true if compression is enabled, false otherwise.</returns> |
| 1 | 1314 | | public bool? ice_getCompress() => _reference.getCompress(); |
| | 1315 | |
|
| | 1316 | | /// <summary> |
| | 1317 | | /// Creates a new proxy that is identical to this proxy, except for its connection ID. |
| | 1318 | | /// </summary> |
| | 1319 | | /// <param name="connectionId">The connection ID for the new proxy. An empty string removes the |
| | 1320 | | /// connection ID.</param> |
| | 1321 | | /// <returns>A new proxy with the specified connection ID.</returns> |
| | 1322 | | public ObjectPrx ice_connectionId(string connectionId) |
| | 1323 | | { |
| 1 | 1324 | | if (connectionId == _reference.getConnectionId()) |
| | 1325 | | { |
| 0 | 1326 | | return this; |
| | 1327 | | } |
| | 1328 | | else |
| | 1329 | | { |
| 1 | 1330 | | return iceNewInstance(_reference.changeConnectionId(connectionId)); |
| | 1331 | | } |
| | 1332 | | } |
| | 1333 | |
|
| | 1334 | | /// <summary> |
| | 1335 | | /// Gets the connection id of this proxy. |
| | 1336 | | /// </summary> |
| | 1337 | | /// <returns>The connection id.</returns> |
| 1 | 1338 | | public string ice_getConnectionId() => _reference.getConnectionId(); |
| | 1339 | |
|
| | 1340 | | /// <summary> |
| | 1341 | | /// Returns a proxy that is identical to this proxy, except it's a fixed proxy bound |
| | 1342 | | /// the given connection. |
| | 1343 | | /// </summary> |
| | 1344 | | /// <param name="connection">The fixed proxy connection.</param> |
| | 1345 | | /// <returns>A fixed proxy bound to the given connection.</returns> |
| | 1346 | | public ObjectPrx ice_fixed(Ice.Connection connection) |
| | 1347 | | { |
| 1 | 1348 | | if (connection is null) |
| | 1349 | | { |
| 1 | 1350 | | throw new ArgumentException("invalid null connection passed to ice_fixed"); |
| | 1351 | | } |
| 1 | 1352 | | if (!(connection is Ice.ConnectionI)) |
| | 1353 | | { |
| 0 | 1354 | | throw new ArgumentException("invalid connection passed to ice_fixed"); |
| | 1355 | | } |
| | 1356 | |
|
| 1 | 1357 | | if (connection == _reference.getConnection()) |
| | 1358 | | { |
| 1 | 1359 | | return this; |
| | 1360 | | } |
| | 1361 | | else |
| | 1362 | | { |
| 1 | 1363 | | return iceNewInstance(_reference.changeConnection((Ice.ConnectionI)connection)); |
| | 1364 | | } |
| | 1365 | | } |
| | 1366 | |
|
| | 1367 | | /// <summary> |
| | 1368 | | /// Returns whether this proxy is a fixed proxy. |
| | 1369 | | /// </summary> |
| | 1370 | | /// <returns>True if this is a fixed proxy, false otherwise. |
| | 1371 | | /// </returns> |
| 1 | 1372 | | public bool ice_isFixed() => _reference is Ice.Internal.FixedReference; |
| | 1373 | |
|
| | 1374 | | public class GetConnectionTaskCompletionCallback : TaskCompletionCallback<Connection?> |
| | 1375 | | { |
| | 1376 | | public GetConnectionTaskCompletionCallback( |
| | 1377 | | IProgress<bool>? progress = null, |
| | 1378 | | CancellationToken cancellationToken = default) |
| 1 | 1379 | | : base(progress, cancellationToken) |
| | 1380 | | { |
| 1 | 1381 | | } |
| | 1382 | |
|
| | 1383 | | public override void handleInvokeResponse(bool ok, OutgoingAsyncBase og) => |
| 1 | 1384 | | SetResult(((ProxyGetConnection)og).getConnection()); |
| | 1385 | | } |
| | 1386 | |
|
| | 1387 | | public Connection? ice_getConnection() |
| | 1388 | | { |
| | 1389 | | try |
| | 1390 | | { |
| 1 | 1391 | | var completed = new GetConnectionTaskCompletionCallback(); |
| 1 | 1392 | | iceI_ice_getConnection(completed, true); |
| 1 | 1393 | | return completed.Task.Result; |
| | 1394 | | } |
| 1 | 1395 | | catch (AggregateException ex) |
| | 1396 | | { |
| 1 | 1397 | | throw ex.InnerException!; |
| | 1398 | | } |
| 1 | 1399 | | } |
| | 1400 | |
|
| | 1401 | | public Task<Connection?> ice_getConnectionAsync(IProgress<bool>? progress, CancellationToken cancel) |
| | 1402 | | { |
| 1 | 1403 | | var completed = new GetConnectionTaskCompletionCallback(progress, cancel); |
| 1 | 1404 | | iceI_ice_getConnection(completed, false); |
| 1 | 1405 | | return completed.Task; |
| | 1406 | | } |
| | 1407 | |
|
| | 1408 | | private const string _ice_getConnection_name = "ice_getConnection"; |
| | 1409 | |
|
| | 1410 | | private void iceI_ice_getConnection(OutgoingAsyncCompletionCallback completed, bool synchronous) |
| | 1411 | | { |
| 1 | 1412 | | var outgoing = new ProxyGetConnection(this, completed); |
| 1 | 1413 | | outgoing.invoke(_ice_getConnection_name, synchronous); |
| 1 | 1414 | | } |
| | 1415 | |
|
| | 1416 | | /// <summary> |
| | 1417 | | /// Gets the cached Connection for this proxy. If the proxy does not yet have an established |
| | 1418 | | /// connection, it does not attempt to create a connection. |
| | 1419 | | /// </summary> |
| | 1420 | | /// <returns>The cached Connection for this proxy (null if the proxy does not have |
| | 1421 | | /// an established connection).</returns> |
| 1 | 1422 | | public Connection? ice_getCachedConnection() => _requestHandlerCache.cachedConnection; |
| | 1423 | |
|
| | 1424 | | /// <summary> |
| | 1425 | | /// Flushes any pending batched requests for this communicator. The call blocks until the flush is complete. |
| | 1426 | | /// </summary> |
| | 1427 | | public void ice_flushBatchRequests() |
| | 1428 | | { |
| | 1429 | | try |
| | 1430 | | { |
| 1 | 1431 | | var completed = new FlushBatchTaskCompletionCallback(); |
| 1 | 1432 | | iceI_ice_flushBatchRequests(completed, true); |
| 1 | 1433 | | completed.Task.Wait(); |
| 1 | 1434 | | } |
| 0 | 1435 | | catch (AggregateException ex) |
| | 1436 | | { |
| 0 | 1437 | | throw ex.InnerException!; |
| | 1438 | | } |
| 1 | 1439 | | } |
| | 1440 | |
|
| | 1441 | | internal const string _ice_flushBatchRequests_name = "ice_flushBatchRequests"; |
| | 1442 | |
|
| | 1443 | | public Task ice_flushBatchRequestsAsync( |
| | 1444 | | IProgress<bool>? progress = null, |
| | 1445 | | CancellationToken cancel = default) |
| | 1446 | | { |
| 1 | 1447 | | var completed = new FlushBatchTaskCompletionCallback(progress, cancel); |
| 1 | 1448 | | iceI_ice_flushBatchRequests(completed, false); |
| 1 | 1449 | | return completed.Task; |
| | 1450 | | } |
| | 1451 | |
|
| | 1452 | | private void iceI_ice_flushBatchRequests(OutgoingAsyncCompletionCallback completed, bool synchronous) |
| | 1453 | | { |
| 1 | 1454 | | var outgoing = new ProxyFlushBatchAsync(this, completed); |
| 1 | 1455 | | outgoing.invoke(_ice_flushBatchRequests_name, synchronous); |
| 1 | 1456 | | } |
| | 1457 | |
|
| 1 | 1458 | | public System.Threading.Tasks.TaskScheduler ice_scheduler() => _reference.getThreadPool(); |
| | 1459 | |
|
| | 1460 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | 1461 | | public void iceWrite(OutputStream os) |
| | 1462 | | { |
| 1 | 1463 | | Identity.ice_write(os, _reference.getIdentity()); |
| 1 | 1464 | | _reference.streamWrite(os); |
| 1 | 1465 | | } |
| | 1466 | |
|
| 1 | 1467 | | internal Reference iceReference() => _reference; |
| | 1468 | |
|
| | 1469 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | 1470 | | public void iceCheckTwowayOnly(string name) |
| | 1471 | | { |
| | 1472 | | // |
| | 1473 | | // No mutex lock necessary, there is nothing mutable in this |
| | 1474 | | // operation. |
| | 1475 | | // |
| | 1476 | |
|
| 1 | 1477 | | if (!ice_isTwoway()) |
| | 1478 | | { |
| 1 | 1479 | | throw new TwowayOnlyException(name); |
| | 1480 | | } |
| 1 | 1481 | | } |
| | 1482 | |
|
| | 1483 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | 1484 | | public void iceCheckAsyncTwowayOnly(string name) |
| | 1485 | | { |
| | 1486 | | // |
| | 1487 | | // No mutex lock necessary, there is nothing mutable in this |
| | 1488 | | // operation. |
| | 1489 | | // |
| | 1490 | |
|
| 1 | 1491 | | if (!ice_isTwoway()) |
| | 1492 | | { |
| 0 | 1493 | | throw new ArgumentException("`" + name + "' can only be called with a twoway proxy"); |
| | 1494 | | } |
| 1 | 1495 | | } |
| | 1496 | |
|
| 1 | 1497 | | internal RequestHandlerCache iceGetRequestHandlerCache() => _requestHandlerCache; |
| | 1498 | |
|
| 1 | 1499 | | protected ObjectPrxHelperBase(ObjectPrx proxy) |
| | 1500 | | { |
| | 1501 | | // We don't supported decorated proxies here. |
| 1 | 1502 | | var helper = (ObjectPrxHelperBase)proxy; |
| | 1503 | |
|
| 1 | 1504 | | _reference = helper._reference; |
| 1 | 1505 | | _requestHandlerCache = helper._requestHandlerCache; |
| 1 | 1506 | | } |
| | 1507 | |
|
| | 1508 | | protected OutgoingAsyncT<T> |
| | 1509 | | getOutgoingAsync<T>(OutgoingAsyncCompletionCallback completed) |
| | 1510 | | { |
| 1 | 1511 | | bool haveEntry = false; |
| 1 | 1512 | | InputStream? iss = null; |
| 1 | 1513 | | OutputStream? os = null; |
| | 1514 | |
|
| 1 | 1515 | | if (_reference.getInstance().cacheMessageBuffers() > 0) |
| | 1516 | | { |
| 1 | 1517 | | lock (_mutex) |
| | 1518 | | { |
| 1 | 1519 | | if (_streamCache != null && _streamCache.Count > 0) |
| | 1520 | | { |
| 1 | 1521 | | haveEntry = true; |
| 1 | 1522 | | iss = _streamCache.First!.Value.iss; |
| 1 | 1523 | | os = _streamCache.First.Value.os; |
| | 1524 | |
|
| 1 | 1525 | | _streamCache.RemoveFirst(); |
| | 1526 | | } |
| 1 | 1527 | | } |
| | 1528 | | } |
| 1 | 1529 | | if (!haveEntry) |
| | 1530 | | { |
| 1 | 1531 | | return new OutgoingAsyncT<T>(this, completed); |
| | 1532 | | } |
| | 1533 | | else |
| | 1534 | | { |
| 1 | 1535 | | return new OutgoingAsyncT<T>(this, completed, os, iss); |
| | 1536 | | } |
| | 1537 | | } |
| | 1538 | |
|
| | 1539 | | private class InvokeOutgoingAsyncT : OutgoingAsync |
| | 1540 | | { |
| | 1541 | | public InvokeOutgoingAsyncT( |
| | 1542 | | ObjectPrxHelperBase prx, |
| | 1543 | | OutgoingAsyncCompletionCallback completionCallback, |
| | 1544 | | OutputStream? os = null, |
| | 1545 | | InputStream? iss = null) |
| 1 | 1546 | | : base(prx, completionCallback, os, iss) |
| | 1547 | | { |
| 1 | 1548 | | } |
| | 1549 | |
|
| | 1550 | | public void invoke( |
| | 1551 | | string operation, |
| | 1552 | | OperationMode mode, |
| | 1553 | | byte[] inParams, |
| | 1554 | | Dictionary<string, string>? context, |
| | 1555 | | bool synchronous) |
| | 1556 | | { |
| | 1557 | | try |
| | 1558 | | { |
| 1 | 1559 | | prepare(operation, mode, context); |
| 1 | 1560 | | if (inParams is null || inParams.Length == 0) |
| | 1561 | | { |
| 1 | 1562 | | os_.writeEmptyEncapsulation(encoding_); |
| | 1563 | | } |
| | 1564 | | else |
| | 1565 | | { |
| 1 | 1566 | | os_.writeEncapsulation(inParams); |
| | 1567 | | } |
| 1 | 1568 | | invoke(operation, synchronous); |
| 1 | 1569 | | } |
| 0 | 1570 | | catch (Exception ex) |
| | 1571 | | { |
| 0 | 1572 | | abort(ex); |
| 0 | 1573 | | } |
| 1 | 1574 | | } |
| | 1575 | |
|
| | 1576 | | public Object_Ice_invokeResult |
| | 1577 | | getResult(bool ok) |
| | 1578 | | { |
| | 1579 | | try |
| | 1580 | | { |
| 1 | 1581 | | var ret = new Object_Ice_invokeResult(); |
| 1 | 1582 | | if (proxy_.iceReference().isTwoway) |
| | 1583 | | { |
| 1 | 1584 | | ret.outEncaps = is_.readEncapsulation(out _); |
| | 1585 | | } |
| | 1586 | | else |
| | 1587 | | { |
| 1 | 1588 | | ret.outEncaps = []; |
| | 1589 | | } |
| 1 | 1590 | | ret.returnValue = ok; |
| 1 | 1591 | | return ret; |
| | 1592 | | } |
| | 1593 | | finally |
| | 1594 | | { |
| 1 | 1595 | | cacheMessageBuffers(); |
| 1 | 1596 | | } |
| 1 | 1597 | | } |
| | 1598 | | } |
| | 1599 | |
|
| | 1600 | | private class InvokeTaskCompletionCallback : TaskCompletionCallback<Object_Ice_invokeResult> |
| | 1601 | | { |
| | 1602 | | public InvokeTaskCompletionCallback(IProgress<bool>? progress, CancellationToken cancellationToken) |
| 1 | 1603 | | : base(progress, cancellationToken) |
| | 1604 | | { |
| 1 | 1605 | | } |
| | 1606 | |
|
| | 1607 | | public override void handleInvokeSent( |
| | 1608 | | bool sentSynchronously, |
| | 1609 | | bool done, |
| | 1610 | | bool alreadySent, |
| | 1611 | | OutgoingAsyncBase og) |
| | 1612 | | { |
| 1 | 1613 | | if (progress_ != null && !alreadySent) |
| | 1614 | | { |
| 0 | 1615 | | progress_.Report(sentSynchronously); |
| | 1616 | | } |
| 1 | 1617 | | if (done) |
| | 1618 | | { |
| 1 | 1619 | | SetResult(new Object_Ice_invokeResult(true, [])); |
| | 1620 | | } |
| 1 | 1621 | | } |
| | 1622 | |
|
| | 1623 | | public override void handleInvokeResponse(bool ok, OutgoingAsyncBase og) => |
| 1 | 1624 | | SetResult(((InvokeOutgoingAsyncT)og).getResult(ok)); |
| | 1625 | | } |
| | 1626 | |
|
| | 1627 | | private InvokeOutgoingAsyncT |
| | 1628 | | getInvokeOutgoingAsync(OutgoingAsyncCompletionCallback completed) |
| | 1629 | | { |
| 1 | 1630 | | bool haveEntry = false; |
| 1 | 1631 | | InputStream? iss = null; |
| 1 | 1632 | | OutputStream? os = null; |
| | 1633 | |
|
| 1 | 1634 | | if (_reference.getInstance().cacheMessageBuffers() > 0) |
| | 1635 | | { |
| 1 | 1636 | | lock (_mutex) |
| | 1637 | | { |
| 1 | 1638 | | if (_streamCache != null && _streamCache.Count > 0) |
| | 1639 | | { |
| 1 | 1640 | | haveEntry = true; |
| 1 | 1641 | | iss = _streamCache.First!.Value.iss; |
| 1 | 1642 | | os = _streamCache.First.Value.os; |
| | 1643 | |
|
| 1 | 1644 | | _streamCache.RemoveFirst(); |
| | 1645 | | } |
| 1 | 1646 | | } |
| | 1647 | | } |
| 1 | 1648 | | if (!haveEntry) |
| | 1649 | | { |
| 1 | 1650 | | return new InvokeOutgoingAsyncT(this, completed); |
| | 1651 | | } |
| | 1652 | | else |
| | 1653 | | { |
| 1 | 1654 | | return new InvokeOutgoingAsyncT(this, completed, os, iss); |
| | 1655 | | } |
| | 1656 | | } |
| | 1657 | |
|
| | 1658 | | internal void cacheMessageBuffers(InputStream iss, OutputStream os) |
| | 1659 | | { |
| 1 | 1660 | | lock (_mutex) |
| | 1661 | | { |
| 1 | 1662 | | _streamCache ??= new LinkedList<(InputStream, OutputStream)>(); |
| 1 | 1663 | | _streamCache.AddLast((iss, os)); |
| 1 | 1664 | | } |
| 1 | 1665 | | } |
| | 1666 | |
|
| | 1667 | | /// <summary> |
| | 1668 | | /// Initializes a new instance of the <see cref="ObjectPrxHelperBase" /> class. |
| | 1669 | | /// </summary> |
| | 1670 | | /// <param name="reference">The reference for the new proxy.</param> |
| | 1671 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| 1 | 1672 | | protected ObjectPrxHelperBase(Reference reference) |
| | 1673 | | { |
| 1 | 1674 | | _reference = reference; |
| 1 | 1675 | | _requestHandlerCache = new RequestHandlerCache(reference); |
| 1 | 1676 | | } |
| | 1677 | |
|
| | 1678 | | /// <summary> |
| | 1679 | | /// Constructs a new proxy instance. |
| | 1680 | | /// </summary> |
| | 1681 | | /// <param name="reference">The reference for the new proxy.</param> |
| | 1682 | | /// <returns>The new proxy instance.</returns> |
| | 1683 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | 1684 | | protected abstract ObjectPrxHelperBase iceNewInstance(Reference reference); |
| | 1685 | |
|
| | 1686 | | private readonly Reference _reference; |
| | 1687 | | private readonly RequestHandlerCache _requestHandlerCache; |
| | 1688 | | private LinkedList<(InputStream iss, OutputStream os)>? _streamCache; |
| 1 | 1689 | | private readonly object _mutex = new(); |
| | 1690 | | } |
| | 1691 | |
|
| | 1692 | | /// <summary> |
| | 1693 | | /// Base class for all proxy helpers. |
| | 1694 | | /// </summary> |
| | 1695 | | public class ObjectPrxHelper : ObjectPrxHelperBase |
| | 1696 | | { |
| | 1697 | | /// <summary> |
| | 1698 | | /// Creates a new proxy that implements <see cref="ObjectPrx" />. |
| | 1699 | | /// </summary> |
| | 1700 | | /// <param name="communicator">The communicator of the new proxy.</param> |
| | 1701 | | /// <param name="proxyString">The string representation of the proxy.</param> |
| | 1702 | | /// <returns>The new proxy.</returns> |
| | 1703 | | /// <exception name="ParseException">Thrown when <paramref name="proxyString" /> is not a valid proxy string. |
| | 1704 | | /// </exception> |
| | 1705 | | public static ObjectPrx createProxy(Communicator communicator, string proxyString) |
| | 1706 | | { |
| | 1707 | | Reference? reference = communicator.instance.referenceFactory().create(proxyString, ""); |
| | 1708 | |
|
| | 1709 | | return reference is not null ? |
| | 1710 | | new ObjectPrxHelper(reference) : |
| | 1711 | | throw new ParseException("Invalid empty proxy string."); |
| | 1712 | | } |
| | 1713 | |
|
| | 1714 | | /// <summary> |
| | 1715 | | /// Creates a new proxy from an existing proxy after confirming the target object's type via a remote invocation. |
| | 1716 | | /// </summary> |
| | 1717 | | /// <param name="proxy">The source proxy.</param> |
| | 1718 | | /// <param name="context">The request context.</param> |
| | 1719 | | /// <returns>A new proxy with the requested type, or null if the target object does not support the requested type. |
| | 1720 | | /// </returns> |
| | 1721 | | public static ObjectPrx? checkedCast(ObjectPrx? proxy, Dictionary<string, string>? context = null) => |
| | 1722 | | proxy is not null && proxy.ice_isA("::Ice::Object", context) ? proxy : null; |
| | 1723 | |
|
| | 1724 | | /// <summary> |
| | 1725 | | /// Creates a new proxy from an existing proxy after confirming the target object's type via a remote invocation. |
| | 1726 | | /// </summary> |
| | 1727 | | /// <param name="proxy">The source proxy (can be null).</param> |
| | 1728 | | /// <param name="facet">A facet name.</param> |
| | 1729 | | /// <param name="context">The request context.</param> |
| | 1730 | | /// <returns>A new proxy with the requested type and facet, or null if the target facet does not support the |
| | 1731 | | /// requested type.</returns> |
| | 1732 | | public static ObjectPrx? checkedCast(ObjectPrx? proxy, string facet, Dictionary<string, string>? context = null) => |
| | 1733 | | checkedCast(proxy?.ice_facet(facet), context); |
| | 1734 | |
|
| | 1735 | | /// <summary> |
| | 1736 | | /// Creates a new proxy from an existing proxy after confirming the target object's type via a remote invocation. |
| | 1737 | | /// </summary> |
| | 1738 | | /// <param name="proxy">The source proxy.</param> |
| | 1739 | | /// <param name="context">The request context.</param> |
| | 1740 | | /// <param name="progress">Sent progress provider.</param> |
| | 1741 | | /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> |
| | 1742 | | /// <returns>A new proxy with the requested type, or null if the target object does not support the requested type. |
| | 1743 | | /// </returns> |
| | 1744 | | public static async Task<ObjectPrx?> checkedCastAsync( |
| | 1745 | | ObjectPrx proxy, |
| | 1746 | | Dictionary<string, string>? context = null, |
| | 1747 | | IProgress<bool>? progress = null, |
| | 1748 | | CancellationToken cancel = default) => |
| | 1749 | | await proxy.ice_isAAsync("::Ice::Object", context, progress, cancel).ConfigureAwait(false) ? proxy : null; |
| | 1750 | |
|
| | 1751 | | /// <summary> |
| | 1752 | | /// Creates a new proxy from an existing proxy after confirming the target object's type via a remote invocation. |
| | 1753 | | /// </summary> |
| | 1754 | | /// <param name="proxy">The source proxy.</param> |
| | 1755 | | /// <param name="facet">A facet name.</param> |
| | 1756 | | /// <param name="context">The request context.</param> |
| | 1757 | | /// <param name="progress">Sent progress provider.</param> |
| | 1758 | | /// <param name="cancel">A cancellation token that receives the cancellation requests.</param> |
| | 1759 | | /// <returns>A new proxy with the requested type and facet, or null if the target facet does not support the |
| | 1760 | | /// requested type.</returns> |
| | 1761 | | public static Task<ObjectPrx?> checkedCastAsync( |
| | 1762 | | ObjectPrx proxy, |
| | 1763 | | string facet, |
| | 1764 | | Dictionary<string, string>? context = null, |
| | 1765 | | IProgress<bool>? progress = null, |
| | 1766 | | CancellationToken cancel = default) => |
| | 1767 | | checkedCastAsync(proxy.ice_facet(facet), context, progress, cancel); |
| | 1768 | |
|
| | 1769 | | /// <summary> |
| | 1770 | | /// Creates a new proxy from an existing proxy. |
| | 1771 | | /// </summary> |
| | 1772 | | /// <param name="proxy">The source proxy.</param> |
| | 1773 | | /// <returns>A new proxy with the requested type.</returns> |
| | 1774 | | /// <remarks>This is a purely local operation.</remarks> |
| | 1775 | | [return: NotNullIfNotNull(nameof(proxy))] |
| | 1776 | | public static ObjectPrx? uncheckedCast(ObjectPrx? proxy) => proxy; |
| | 1777 | |
|
| | 1778 | | /// <summary> |
| | 1779 | | /// Creates a new proxy from an existing proxy. |
| | 1780 | | /// </summary> |
| | 1781 | | /// <param name="proxy">The source proxy.</param> |
| | 1782 | | /// <param name="facet">A facet name.</param> |
| | 1783 | | /// <returns>A new proxy with the requested type and facet, or null if the source proxy is null.</returns> |
| | 1784 | | /// <remarks>This is a purely local operation.</remarks> |
| | 1785 | | [return: NotNullIfNotNull(nameof(proxy))] |
| | 1786 | | public static ObjectPrx? uncheckedCast(ObjectPrx? proxy, string facet) => proxy?.ice_facet(facet); |
| | 1787 | |
|
| | 1788 | | /// <summary> |
| | 1789 | | /// Gets the Slice type id of the interface or class associated with this proxy class. |
| | 1790 | | /// </summary> |
| | 1791 | | /// <returns>The type id, "::Ice::Object".</returns> |
| | 1792 | | public static string ice_staticId() => Object.ice_staticId(); |
| | 1793 | |
|
| | 1794 | | protected override ObjectPrxHelperBase iceNewInstance(Reference reference) => new ObjectPrxHelper(reference); |
| | 1795 | |
|
| | 1796 | | internal ObjectPrxHelper(Reference reference) |
| | 1797 | | : base(reference) |
| | 1798 | | { |
| | 1799 | | } |
| | 1800 | | } |