//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
using System.ComponentModel;
using IceUtilInternal;
using IceInternal;
namespace Ice
{
///
/// Delegate for a successful ice_isA invocation.
/// True if the remote object supports the type, false otherwise.
///
public delegate void Callback_Object_ice_isA(bool ret);
///
/// Delegate for a successful ice_ids invocation.
/// The array of Slice type ids supported by the remote object.
///
public delegate void Callback_Object_ice_ids(string[] ret);
///
/// Delegate for a successful ice_id invocation.
/// The Slice type id of the most-derived interface supported by the remote object.
///
public delegate void Callback_Object_ice_id(string ret);
///
/// Delegate for a successful ice_ping invocation.
///
public delegate void Callback_Object_ice_ping();
///
/// Delegate for a successful ice_invoke invocation.
/// True if the invocation succeeded, or false if the invocation
/// raised a user exception.
/// The encoded out-parameters or user exception.
///
public delegate void Callback_Object_ice_invoke(bool ret, byte[] outEncaps);
///
/// Delegate for a successful ice_getConnection invocation.
/// The connection used by the proxy.
///
public delegate void Callback_Object_ice_getConnection(Connection ret);
///
/// Value type to allow differenciate between a context that is explicity set to
/// empty (empty or null dictionary) and a context that has non been set.
///
public struct OptionalContext
{
private OptionalContext(Dictionary ctx)
{
_ctx = ctx == null ? _emptyContext : ctx;
}
///
/// Implicit conversion between Dictionary<string, string> and
/// OptionalContext.
///
/// Dictionary to convert.
/// OptionalContext value representing the dictionary
public static implicit operator OptionalContext(Dictionary ctx)
{
return new OptionalContext(ctx);
}
///
/// Implicit conversion between OptionalContext and
/// Dictionary<string, string>
///
/// OptionalContext value to convert
/// The Dictionary object.
public static implicit operator Dictionary(OptionalContext value)
{
return value._ctx;
}
private Dictionary _ctx;
static private Dictionary _emptyContext = new Dictionary();
}
///
/// Base interface of all object proxies.
///
public interface ObjectPrx
{
///
/// Returns the communicator that created this proxy.
///
/// The communicator that created this proxy.
Communicator ice_getCommunicator();
///
/// Tests whether this object supports a specific Slice interface.
///
/// The type ID of the Slice interface to test against.
/// The context dictionary for the invocation.
/// True if the target object has the interface specified by id or derives
/// from the interface specified by id.
bool ice_isA(string id, OptionalContext context = new OptionalContext());
///
/// Tests whether this object supports a specific Slice interface.
///
/// The type ID of the Slice interface to test against.
/// The context dictionary for the invocation.
/// Sent progress provider.
/// A cancellation token that receives the cancellation requests.
/// The task object representing the asynchronous operation.
Task ice_isAAsync(string id,
OptionalContext context = new OptionalContext(),
IProgress progress = null,
CancellationToken cancel = new CancellationToken());
///
/// Tests whether this object supports a specific Slice interface.
///
/// The type ID of the Slice interface to test against.
/// A callback to be invoked when the invocation completes.
/// Application-specific data to be stored in the result.
/// An asynchronous result object.
AsyncResult begin_ice_isA(string id, AsyncCallback callback, object cookie);
///
/// Tests whether this object supports a specific Slice interface.
///
/// The type ID of the Slice interface to test against.
/// The context dictionary for the invocation.
/// A callback to be invoked when the invocation completes.
/// Application-specific data to be stored in the result.
/// An asynchronous result object.
AsyncResult begin_ice_isA(string id, OptionalContext context, AsyncCallback callback, object cookie);
///
/// Tests whether this object supports a specific Slice interface.
///
/// The type ID of the Slice interface to test against.
/// The context dictionary for the invocation.
/// An asynchronous result object.
AsyncResult begin_ice_isA(string id, OptionalContext context = new OptionalContext());
///
/// Tests whether this object supports a specific Slice interface.
///
/// The asynchronous result object returned by begin_ice_isA.
/// True if the object supports the Slice interface, false otherwise.
bool end_ice_isA(AsyncResult result);
///
/// Tests whether the target object of this proxy can be reached.
///
/// The context dictionary for the invocation.
void ice_ping(OptionalContext context = new OptionalContext());
///
/// Tests whether the target object of this proxy can be reached.
///
/// The context dictionary for the invocation.
/// Sent progress provider.
/// A cancellation token that receives the cancellation requests.
/// The task object representing the asynchronous operation.
Task ice_pingAsync(OptionalContext context = new OptionalContext(),
IProgress progress = null,
CancellationToken cancel = new CancellationToken());
///
/// Tests whether the target object of this proxy can be reached.
///
/// A callback to be invoked when the invocation completes.
/// Application-specific data to be stored in the result.
/// An asynchronous result object.
AsyncResult begin_ice_ping(AsyncCallback callback, object cookie);
///
/// Tests whether the target object of this proxy can be reached.
///
/// The context dictionary for the invocation.
/// A callback to be invoked when the invocation completes.
/// Application-specific data to be stored in the result.
/// An asynchronous result object.
AsyncResult begin_ice_ping(OptionalContext context, AsyncCallback callback, object cookie);
///
/// Tests whether the target object of this proxy can be reached.
///
/// The context dictionary for the invocation.
/// An asynchronous result object.
AsyncResult begin_ice_ping(OptionalContext context = new OptionalContext());
///
/// Tests whether the target object of this proxy can be reached.
///
/// The asynchronous result object returned by begin_ice_ping.
void end_ice_ping(AsyncResult result);
///
/// Returns the Slice type IDs of the interfaces supported by the target object of this proxy.
///
/// The context dictionary for the invocation.
/// The Slice type IDs of the interfaces supported by the target object, in base-to-derived
/// order. The first element of the returned array is always ::Ice::Object.
string[] ice_ids(OptionalContext context = new OptionalContext());
///
/// Returns the Slice type IDs of the interfaces supported by the target object of this proxy.
///
/// The context dictionary for the invocation.
/// Sent progress provider.
/// A cancellation token that receives the cancellation requests.
/// The task object representing the asynchronous operation.
Task ice_idsAsync(OptionalContext context = new OptionalContext(),
IProgress progress = null,
CancellationToken cancel = new CancellationToken());
///
/// Returns the Slice type IDs of the interfaces supported by the target object of this proxy.
///
/// A callback to be invoked when the invocation completes.
/// Application-specific data to be stored in the result.
/// An asynchronous result object.
AsyncResult begin_ice_ids(AsyncCallback callback, object cookie);
///
/// Returns the Slice type IDs of the interfaces supported by the target object of this proxy.
///
/// The context dictionary for the invocation.
/// A callback to be invoked when the invocation completes.
/// Application-specific data to be stored in the result.
/// An asynchronous result object.
AsyncResult begin_ice_ids(OptionalContext context, AsyncCallback callback, object cookie);
///
/// Returns the Slice type IDs of the interfaces supported by the target object of this proxy.
///
/// The context dictionary for the invocation.
/// An asynchronous result object.
AsyncResult begin_ice_ids(OptionalContext context = new OptionalContext());
///
/// Returns the Slice type IDs of the interfaces supported by the target object of this proxy.
///
/// The asynchronous result object returned by begin_ice_ids.
/// The Slice type IDs of the interfaces supported by the target object, in base-to-derived
/// order. The first element of the returned array is always ::Ice::Object.
string[] end_ice_ids(AsyncResult result);
///
/// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy.
///
/// The context dictionary for the invocation.
/// The Slice type ID of the most-derived interface.
string ice_id(OptionalContext context = new OptionalContext());
///
/// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy.
///
/// The context dictionary for the invocation.
/// Sent progress provider.
/// A cancellation token that receives the cancellation requests.
/// The task object representing the asynchronous operation.
Task ice_idAsync(OptionalContext context = new OptionalContext(),
IProgress progress = null,
CancellationToken cancel = new CancellationToken());
///
/// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy.
///
/// A callback to be invoked when the invocation completes.
/// Application-specific data to be stored in the result.
/// An asynchronous result object.
AsyncResult begin_ice_id(AsyncCallback callback, object cookie);
///
/// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy.
///
/// The context dictionary for the invocation.
/// A callback to be invoked when the invocation completes.
/// Application-specific data to be stored in the result.
/// An asynchronous result object.
AsyncResult begin_ice_id(OptionalContext context, AsyncCallback callback, object cookie);
///
/// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy.
///
/// The context dictionary for the invocation.
/// An asynchronous result object.
AsyncResult begin_ice_id(OptionalContext context = new OptionalContext());
///
/// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy.
///
/// The asynchronous result object returned by begin_ice_id.
/// The Slice type ID of the most-derived interface.
string end_ice_id(AsyncResult result);
///
/// Invokes an operation dynamically.
///
/// The name of the operation to invoke.
/// The operation mode (normal or idempotent).
/// The encoded in-parameters for the operation.
/// The encoded out-paramaters and return value
/// for the operation. The return value follows any out-parameters.
/// The context dictionary for the invocation.
/// If the operation completed successfully, the return value
/// is true. If the operation raises a user exception,
/// the return value is false; in this case, outEncaps
/// contains the encoded user exception. If the operation raises a run-time exception,
/// it throws it directly.
bool ice_invoke(string operation, OperationMode mode, byte[] inEncaps, out byte[] outEncaps,
OptionalContext context = new OptionalContext());
///
/// Invokes an operation dynamically.
///
/// The name of the operation to invoke.
/// The operation mode (normal or idempotent).
/// The encoded in-parameters for the operation.
/// The context dictionary for the invocation.
/// Sent progress provider.
/// A cancellation token that receives the cancellation requests.
/// The task object representing the asynchronous operation.
Task
ice_invokeAsync(string operation,
OperationMode mode,
byte[] inEncaps,
OptionalContext context = new OptionalContext(),
IProgress progress = null,
CancellationToken cancel = new CancellationToken());
///
/// Invokes an operation dynamically.
///
/// The name of the operation to invoke.
/// The operation mode (normal or idempotent).
/// The encoded in-parameters for the operation.
/// A callback to be invoked when the invocation completes.
/// Application-specific data to be stored in the result.
/// An asynchronous result object.
AsyncResult begin_ice_invoke(string operation,
OperationMode mode,
byte[] inEncaps,
AsyncCallback callback,
object cookie);
///
/// Invokes an operation dynamically.
///
/// The name of the operation to invoke.
/// The operation mode (normal or idempotent).
/// The encoded in-parameters for the operation.
/// The context dictionary for the invocation.
/// A callback to be invoked when the invocation completes.
/// Application-specific data to be stored in the result.
/// An asynchronous result object.
AsyncResult begin_ice_invoke(string operation,
OperationMode mode,
byte[] inEncaps,
OptionalContext context,
AsyncCallback callback,
object cookie);
///
/// Invokes an operation dynamically.
///
/// The name of the operation to invoke.
/// The operation mode (normal or idempotent).
/// The encoded in-parameters for the operation.
/// The context dictionary for the invocation.
/// An asynchronous result object.
AsyncResult begin_ice_invoke(string operation,
OperationMode mode,
byte[] inEncaps,
OptionalContext context = new OptionalContext());
///
/// Completes a dynamic invocation.
///
/// The encoded out parameters or user exception.
/// The asynchronous result object returned by begin_ice_invoke.
/// If the operation completed successfully, the return value
/// is true. If the operation raises a user exception,
/// the return value is false; in this case, outEncaps
/// contains the encoded user exception. If the operation raises a run-time exception,
/// it throws it directly.
bool end_ice_invoke(out byte[] outEncaps, AsyncResult result);
///
/// Returns the identity embedded in this proxy.
/// The identity of the target object.
///
Identity ice_getIdentity();
///
/// Creates a new proxy that is identical to this proxy, except for the per-proxy context.
/// The identity for the new proxy.
/// The proxy with the new identity.
///
ObjectPrx ice_identity(Identity newIdentity);
///
/// Returns the per-proxy context for this proxy.
///
/// The per-proxy context. If the proxy does not have a per-proxy (implicit) context, the return value
/// is null.
Dictionary ice_getContext();
///
/// Creates a new proxy that is identical to this proxy, except for the per-proxy context.
///
/// The context for the new proxy.
/// The proxy with the new per-proxy context.
ObjectPrx ice_context(Dictionary newContext);
///
/// Returns the facet for this proxy.
///
/// The facet for this proxy. If the proxy uses the default facet, the return value is the
/// empty string.
string ice_getFacet();
///
/// Creates a new proxy that is identical to this proxy, except for the facet.
///
/// The facet for the new proxy.
/// The proxy with the new facet.
ObjectPrx ice_facet(string newFacet);
///
/// Returns the adapter ID for this proxy.
///
/// The adapter ID. If the proxy does not have an adapter ID, the return value is the
/// empty string.
string ice_getAdapterId();
///
/// Creates a new proxy that is identical to this proxy, except for the adapter ID.
///
/// The adapter ID for the new proxy.
/// The proxy with the new adapter ID.
ObjectPrx ice_adapterId(string newAdapterId);
///
/// Returns the endpoints used by this proxy.
///
/// The endpoints used by this proxy.
Endpoint[] ice_getEndpoints();
///
/// Creates a new proxy that is identical to this proxy, except for the endpoints.
///
/// The endpoints for the new proxy.
/// The proxy with the new endpoints.
ObjectPrx ice_endpoints(Endpoint[] newEndpoints);
///
/// Returns the locator cache timeout of this proxy.
///
/// The locator cache timeout value (in seconds).
int ice_getLocatorCacheTimeout();
///
/// Creates a new proxy that is identical to this proxy, except for the locator cache timeout.
///
/// The new locator cache timeout (in seconds).
ObjectPrx ice_locatorCacheTimeout(int timeout);
///
/// Creates a new proxy that is identical to this proxy, except for the invocation timeout.
///
/// The new invocation timeout (in seconds).
ObjectPrx ice_invocationTimeout(int timeout);
///
/// Returns the invocation timeout of this proxy.
///
/// The invocation timeout value (in seconds).
int ice_getInvocationTimeout();
///
/// Returns whether this proxy caches connections.
///
/// True if this proxy caches connections; false, otherwise.
bool ice_isConnectionCached();
///
/// Creates a new proxy that is identical to this proxy, except for connection caching.
///
/// True if the new proxy should cache connections; false, otherwise.
/// The new proxy with the specified caching policy.
ObjectPrx ice_connectionCached(bool newCache);
///
/// Returns how this proxy selects endpoints (randomly or ordered).
///
/// The endpoint selection policy.
EndpointSelectionType ice_getEndpointSelection();
///
/// Creates a new proxy that is identical to this proxy, except for the endpoint selection policy.
///
/// The new endpoint selection policy.
/// The new proxy with the specified endpoint selection policy.
ObjectPrx ice_endpointSelection(EndpointSelectionType newType);
///
/// Returns whether this proxy communicates only via secure endpoints.
///
/// True if this proxy communicates only via secure endpoints; false, otherwise.
bool ice_isSecure();
///
/// Creates a new proxy that is identical to this proxy, except for how it selects endpoints.
///
/// If b is true, only endpoints that use a secure transport are
/// used by the new proxy. If b is false, the returned proxy uses both secure and insecure
/// endpoints.
/// The new proxy with the specified selection policy.
ObjectPrx ice_secure(bool b);
///
/// Creates a new proxy that is identical to this proxy, except for the encoding used to marshal
/// parameters.
///
/// The encoding version to use to marshal requests parameters.
/// The new proxy with the specified encoding version.
ObjectPrx ice_encodingVersion(EncodingVersion e);
/// Returns the encoding version used to marshal requests parameters.
/// The encoding version.
EncodingVersion ice_getEncodingVersion();
///
/// Returns whether this proxy prefers secure endpoints.
///
/// True if the proxy always attempts to invoke via secure endpoints before it
/// attempts to use insecure endpoints; false, otherwise.
bool ice_isPreferSecure();
///
/// Creates a new proxy that is identical to this proxy, except for its endpoint selection policy.
///
/// If b is true, the new proxy will use secure endpoints for invocations
/// and only use insecure endpoints if an invocation cannot be made via secure endpoints. If b is
/// false, the proxy prefers insecure endpoints to secure ones.
/// The new proxy with the new endpoint selection policy.
ObjectPrx ice_preferSecure(bool b);
///
/// Returns the router for this proxy.
///
/// The router for the proxy. If no router is configured for the proxy, the return value
/// is null.
RouterPrx ice_getRouter();
///
/// Creates a new proxy that is identical to this proxy, except for the router.
///
/// The router for the new proxy.
/// The new proxy with the specified router.
ObjectPrx ice_router(RouterPrx router);
///
/// Returns the locator for this proxy.
///
/// The locator for this proxy. If no locator is configured, the return value is null.
LocatorPrx ice_getLocator();
///
/// Creates a new proxy that is identical to this proxy, except for the locator.
///
/// The locator for the new proxy.
/// The new proxy with the specified locator.
ObjectPrx ice_locator(LocatorPrx locator);
///
/// Returns whether this proxy uses collocation optimization.
///
/// True if the proxy uses collocation optimization; false, otherwise.
bool ice_isCollocationOptimized();
///
/// Creates a new proxy that is identical to this proxy, except for collocation optimization.
///
/// True if the new proxy enables collocation optimization; false, otherwise.
/// The new proxy the specified collocation optimization.
ObjectPrx ice_collocationOptimized(bool b);
///
/// Creates a new proxy that is identical to this proxy, but uses twoway invocations.
///
/// A new proxy that uses twoway invocations.
ObjectPrx ice_twoway();
///
/// Returns whether this proxy uses twoway invocations.
///
/// True if this proxy uses twoway invocations; false, otherwise.
bool ice_isTwoway();
///
/// Creates a new proxy that is identical to this proxy, but uses oneway invocations.
///
/// A new proxy that uses oneway invocations.
ObjectPrx ice_oneway();
///
/// Returns whether this proxy uses oneway invocations.
///
/// True if this proxy uses oneway invocations; false, otherwise.
bool ice_isOneway();
///
/// Creates a new proxy that is identical to this proxy, but uses batch oneway invocations.
///
/// A new proxy that uses batch oneway invocations.
ObjectPrx ice_batchOneway();
///
/// Returns whether this proxy uses batch oneway invocations.
///
/// True if this proxy uses batch oneway invocations; false, otherwise.
bool ice_isBatchOneway();
///
/// Creates a new proxy that is identical to this proxy, but uses datagram invocations.
///
/// A new proxy that uses datagram invocations.
ObjectPrx ice_datagram();
///
/// Returns whether this proxy uses datagram invocations.
///
/// True if this proxy uses datagram invocations; false, otherwise.
bool ice_isDatagram();
///
/// Creates a new proxy that is identical to this proxy, but uses batch datagram invocations.
///
/// A new proxy that uses batch datagram invocations.
ObjectPrx ice_batchDatagram();
///
/// Returns whether this proxy uses batch datagram invocations.
///
/// True if this proxy uses batch datagram invocations; false, otherwise.
bool ice_isBatchDatagram();
///
/// Creates a new proxy that is identical to this proxy, except for compression.
///
/// True enables compression for the new proxy; false disables compression.
/// A new proxy with the specified compression setting.
ObjectPrx ice_compress(bool co);
///
/// Obtains the compression override setting of this proxy.
///
/// The compression override setting. If no optional value is present, no override is
/// set. Otherwise, true if compression is enabled, false otherwise.
Ice.Optional ice_getCompress();
///
/// Creates a new proxy that is identical to this proxy, except for its timeout setting.
///
/// The timeout for the new proxy in milliseconds.
/// A new proxy with the specified timeout.
ObjectPrx ice_timeout(int t);
///
/// Obtains the timeout override of this proxy.
///
/// The timeout override. If no optional value is present, no override is set. Otherwise,
/// returns the timeout override value.
Ice.Optional ice_getTimeout();
///
/// Creates a new proxy that is identical to this proxy, except for its connection ID.
///
/// The connection ID for the new proxy. An empty string removes the
/// connection ID.
/// A new proxy with the specified connection ID.
ObjectPrx ice_connectionId(string connectionId);
///
/// Returns the connection id of this proxy.
///
/// The connection id.
string ice_getConnectionId();
///
/// Returns a proxy that is identical to this proxy, except it's a fixed proxy bound
/// the given connection.
///
/// The fixed proxy connection.
/// A fixed proxy bound to the given connection.
ObjectPrx ice_fixed(Ice.Connection connection);
///
/// Returns whether this proxy is a fixed proxy.
///
/// True if this is a fixed proxy, false otherwise.
///
bool ice_isFixed();
///
/// Returns the Connection for this proxy. If the proxy does not yet have an established connection,
/// it first attempts to create a connection.
///
/// The Connection for this proxy.
/// If the proxy uses collocation optimization and denotes a
/// collocated object.
Connection ice_getConnection();
///
/// Asynchronously gets the connection for this proxy.
///
/// Sent progress provider.
/// A cancellation token that receives the cancellation requests.
/// The task object representing the asynchronous operation.
Task ice_getConnectionAsync(IProgress progress = null,
CancellationToken cancel = new CancellationToken());
///
/// Asynchronously gets the connection for this proxy.
///
/// A callback to be invoked when the invocation completes.
/// Application-specific data to be stored in the result.
/// An asynchronous result object.
AsyncResult begin_ice_getConnection(AsyncCallback callback, object cookie);
///
/// Asynchronously gets the connection for this proxy.
///
/// An asynchronous result object.
AsyncResult begin_ice_getConnection();
///
/// Asynchronously gets the connection for this proxy.
///
/// The asynchronous result object returned by begin_ice_getConnection.
/// The connection.
Connection end_ice_getConnection(AsyncResult result);
///
/// Returns the cached Connection for this proxy. If the proxy does not yet have an established
/// connection, it does not attempt to create a connection.
///
/// The cached Connection for this proxy (null if the proxy does not have
/// an established connection).
/// If the proxy uses collocation optimization and denotes a
/// collocated object.
Connection ice_getCachedConnection();
///
/// Flushes any pending batched requests for this proxy. The call blocks until the flush is complete.
///
void ice_flushBatchRequests();
///
/// Asynchronously flushes any pending batched requests for this proxy.
///
/// Sent progress provider.
/// A cancellation token that receives the cancellation requests.
/// The task object representing the asynchronous operation.
Task ice_flushBatchRequestsAsync(IProgress progress = null,
CancellationToken cancel = new CancellationToken());
///
/// Asynchronously flushes any pending batched requests for this proxy.
///
/// A callback to be invoked when the invocation completes.
/// Application-specific data to be stored in the result.
AsyncResult begin_ice_flushBatchRequests(AsyncCallback callback = null, object cookie = null);
///
/// Flushes any pending batched requests for this proxy. The call blocks until the flush is complete.
///
/// The asynchronous result object returned by begin_ice_getConnection.
void end_ice_flushBatchRequests(AsyncResult result);
///
/// Write a proxy to the output stream.
///
/// Output stream object to write the proxy.
[EditorBrowsable(EditorBrowsableState.Never)]
void iceWrite(OutputStream os);
///
/// Returns a scheduler object that uses the Ice thread pool.
///
/// The task scheduler object.
System.Threading.Tasks.TaskScheduler ice_scheduler();
}
///
/// Represent the result of the ice_invokeAsync operation
///
public struct Object_Ice_invokeResult
{
public Object_Ice_invokeResult(bool returnValue, byte[] outEncaps)
{
this.returnValue = returnValue;
this.outEncaps = outEncaps;
}
///
/// If the operation completed successfully, the return value
/// is true. If the operation raises a user exception,
/// the return value is false; in this case, outEncaps
/// contains the encoded user exception.
///
public bool returnValue;
///
/// The encoded out-paramaters and return value for the operation.
/// The return value follows any out-parameters. If returnValue is
/// false it contains the encoded user exception.
///
public byte[] outEncaps;
};
///
/// Base class of all object proxies.
///
[Serializable]
public class ObjectPrxHelperBase : ObjectPrx, ISerializable
{
public ObjectPrxHelperBase()
{
}
public ObjectPrxHelperBase(SerializationInfo info, StreamingContext context)
{
Instance instance = null;
if(context.Context is Communicator)
{
instance = IceInternal.Util.getInstance(context.Context as Communicator);
}
else if(context.Context is Instance)
{
instance = context.Context as Instance;
}
else
{
throw new ArgumentException("Cannot deserialize proxy: Ice.Communicator not found in StreamingContext");
}
var proxy = (ObjectPrxHelperBase)instance.proxyFactory().stringToProxy(info.GetString("proxy"));
_reference = proxy._reference;
Debug.Assert(proxy._requestHandler == null);
}
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("proxy", ToString());
}
///
/// Returns a hash code for this proxy.
///
/// The hash code.
public override int GetHashCode()
{
return _reference.GetHashCode();
}
///
/// Returns the communicator that created this proxy.
///
/// The communicator that created this proxy.
public Communicator ice_getCommunicator()
{
return _reference.getCommunicator();
}
///
/// Returns the stringified form of this proxy.
///
/// The stringified proxy.
public override string ToString()
{
return _reference.ToString();
}
///
/// Tests whether this object supports a specific Slice interface.
///
/// The type ID of the Slice interface to test against.
/// The context dictionary for the invocation.
/// True if the target object has the interface specified by id or derives
/// from the interface specified by id.
public bool ice_isA(string id, OptionalContext context = new OptionalContext())
{
try
{
return iceI_ice_isAAsync(id, context, null, CancellationToken.None, true).Result;
}
catch(AggregateException ex)
{
throw ex.InnerException;
}
}
///
/// Tests whether this object supports a specific Slice interface.
///
/// The type ID of the Slice interface to test against.
/// The context dictionary for the invocation.
/// Sent progress provider.
/// A cancellation token that receives the cancellation requests.
/// The task object representing the asynchronous operation.
public Task ice_isAAsync(string id,
OptionalContext context = new OptionalContext(),
IProgress progress = null,
CancellationToken cancel = new CancellationToken())
{
return iceI_ice_isAAsync(id, context, progress, cancel, false);
}
private Task
iceI_ice_isAAsync(string id, OptionalContext context, IProgress progress, CancellationToken cancel,
bool synchronous)
{
iceCheckTwowayOnly(_ice_isA_name);
var completed = new OperationTaskCompletionCallback(progress, cancel);
iceI_ice_isA(id, context, completed, synchronous);
return completed.Task;
}
///
/// Tests whether this object supports a specific Slice interface.
///
/// The type ID of the Slice interface to test against.
/// A callback to be invoked when the invocation completes.
/// Application-specific data to be stored in the result.
/// An asynchronous result object.
public AsyncResult begin_ice_isA(string id, AsyncCallback callback, object cookie)
{
return iceI_begin_ice_isA(id, new OptionalContext(), callback, cookie, false);
}
///
/// Tests whether this object supports a specific Slice interface.
///
/// The type ID of the Slice interface to test against.
/// The context dictionary for the invocation.
/// A callback to be invoked when the invocation completes.
/// Application-specific data to be stored in the result.
/// An asynchronous result object.
public AsyncResult begin_ice_isA(string id, OptionalContext context, AsyncCallback callback, object cookie)
{
return iceI_begin_ice_isA(id, context, callback, cookie, false);
}
///
/// Tests whether this object supports a specific Slice interface.
///
/// The type ID of the Slice interface to test against.
/// The context dictionary for the invocation.
/// An asynchronous result object.
public AsyncResult
begin_ice_isA(string id, OptionalContext context = new OptionalContext())
{
return iceI_begin_ice_isA(id, context, null, null, false);
}
private const string _ice_isA_name = "ice_isA";
///
/// Tests whether this object supports a specific Slice interface.
///
/// The asynchronous result object returned by begin_ice_isA.
/// True if the object supports the Slice interface, false otherwise.
public bool end_ice_isA(AsyncResult result)
{
var resultI = AsyncResultI.check(result, this, _ice_isA_name);
return ((OutgoingAsyncT)resultI.OutgoingAsync).getResult(resultI.wait());
}
private AsyncResult
iceI_begin_ice_isA(string id, Dictionary context, AsyncCallback callback, object cookie,
bool synchronous)
{
iceCheckAsyncTwowayOnly(_ice_isA_name);
var completed = new OperationAsyncResultCompletionCallback(
(Callback_Object_ice_isA cb, bool result) =>
{
if(cb != null)
{
cb.Invoke(result);
}
}, this, _ice_isA_name, cookie, callback);
iceI_ice_isA(id, context, completed, synchronous);
return completed;
}
private void iceI_ice_isA(string id,
Dictionary context,
OutgoingAsyncCompletionCallback completed,
bool synchronous)
{
iceCheckAsyncTwowayOnly(_ice_isA_name);
getOutgoingAsync(completed).invoke(_ice_isA_name,
OperationMode.Nonmutating,
FormatType.DefaultFormat,
context,
synchronous,
(OutputStream os) => { os.writeString(id); },
null,
(InputStream iss) => { return iss.readBool(); });
}
///
/// Tests whether the target object of this proxy can be reached.
///
/// The context dictionary for the invocation.
public void ice_ping(OptionalContext context = new OptionalContext())
{
try
{
iceI_ice_pingAsync(context, null, CancellationToken.None, true).Wait();
}
catch(AggregateException ex)
{
throw ex.InnerException;
}
}
///
/// Tests whether the target object of this proxy can be reached.
///
/// The context dictionary for the invocation.
/// Sent progress provider.
/// A cancellation token that receives the cancellation requests.
/// The task object representing the asynchronous operation.
public Task ice_pingAsync(OptionalContext context = new OptionalContext(),
IProgress progress = null,
CancellationToken cancel = new CancellationToken())
{
return iceI_ice_pingAsync(context, progress, cancel, false);
}
private Task
iceI_ice_pingAsync(OptionalContext context, IProgress progress, CancellationToken cancel, bool synchronous)
{
var completed = new OperationTaskCompletionCallback