Ice 3.9
C++ API Reference
Loading...
Searching...
No Matches
Proxy.h
1// Copyright (c) ZeroC, Inc.
2
3#ifndef ICE_PROXY_H
4#define ICE_PROXY_H
5
6#include "BatchRequestQueueF.h"
7#include "CommunicatorF.h"
8#include "Current.h"
9#include "EndpointF.h"
10#include "EndpointSelectionType.h"
11#include "Ice/BuiltinSequences.h"
12#include "LocalExceptions.h"
13#include "ReferenceF.h"
14#include "RequestHandlerF.h"
15
16#include <chrono>
17#include <cstdint>
18#include <functional>
19#include <future>
20#include <iosfwd>
21#include <limits>
22#include <optional>
23#include <stdexcept>
24#include <string_view>
25#include <type_traits>
26
27namespace IceInternal
28{
29 class ProxyGetConnection;
30 class ProxyFlushBatchAsync;
31
32 template<typename T> class OutgoingAsyncT;
33}
34
35namespace Ice
36{
37 /// Marker value used to indicate that no explicit request context was passed to a proxy invocation.
38 ICE_API extern const Context noExplicitContext;
39
40 class LocatorPrx;
41 class ObjectPrx;
42 class OutputStream;
43 class RouterPrx;
44
45 /// Provides typed proxy functions.
46 /// @headerfile Ice/Ice.h
47 template<typename Prx, typename... Bases> class Proxy : public virtual Bases...
48 {
49 public:
50 /// The arrow operator.
51 /// @return A pointer to this object.
52 /// @remark This operator is provided for aesthetics and for compatibility reasons. A proxy is not pointer-like:
53 /// it does not hold a value and can't be null. Calling `greeter->greet("bob")` is 100% equivalent to calling
54 /// `greeter.greet("bob")` when greeter is a GreeterPrx proxy. An advantage of the arrow syntax is it's the same
55 /// whether greeter is a GreeterPrx, an optional<GreeterPrx>, or a smart pointer like in earlier versions of
56 /// Ice. It's also aesthetically pleasing when making invocations: the proxy appears like a pointer to the
57 /// remote object.
58 const Prx* operator->() const noexcept { return &asPrx(); }
59
60 // We don't provide the non-const operator-> because only the assignment operator can modify the proxy.
61
62 /// Creates a proxy that is identical to this proxy, except for the adapter ID.
63 /// @param id The adapter ID for the new proxy.
64 /// @return A proxy with the new adapter ID.
65 [[nodiscard]] Prx ice_adapterId(std::string id) const
66 {
67 return fromReference(asPrx()._adapterId(std::move(id)));
68 }
69
70 /// Creates a proxy that is identical to this proxy, but uses batch datagram invocations.
71 /// @return A proxy that uses batch datagram invocations.
72 [[nodiscard]] Prx ice_batchDatagram() const { return fromReference(asPrx()._batchDatagram()); }
73
74 /// Creates a proxy that is identical to this proxy, but uses batch oneway invocations.
75 /// @return A proxy that uses batch oneway invocations.
76 [[nodiscard]] Prx ice_batchOneway() const { return fromReference(asPrx()._batchOneway()); }
77
78 /// Creates a proxy that is identical to this proxy, except for collocation optimization.
79 /// @param b `true` if the new proxy enables collocation optimization, `false` otherwise.
80 /// @return A proxy with the specified collocation optimization.
81 [[nodiscard]] Prx ice_collocationOptimized(bool b) const
82 {
83 return fromReference(asPrx()._collocationOptimized(b));
84 }
85
86 /// Creates a proxy that is identical to this proxy, except for its compression setting which overrides the
87 /// compression setting from the proxy endpoints.
88 /// @param b `true` enables compression for the new proxy, `false` disables compression.
89 /// @return A proxy with the specified compression override setting.
90 [[nodiscard]] Prx ice_compress(bool b) const { return fromReference(asPrx()._compress(b)); }
91
92 /// Creates a proxy that is identical to this proxy, except for connection caching.
93 /// @param b `true` if the new proxy should cache connections, `false` otherwise.
94 /// @return A proxy with the specified caching policy.
95 [[nodiscard]] Prx ice_connectionCached(bool b) const { return fromReference(asPrx()._connectionCached(b)); }
96
97 /// Creates a proxy that is identical to this proxy, except for its connection ID.
98 /// @param id The connection ID for the new proxy. An empty string removes the connection ID.
99 /// @return A proxy with the specified connection ID.
100 [[nodiscard]] Prx ice_connectionId(std::string id) const
101 {
102 return fromReference(asPrx()._connectionId(std::move(id)));
103 }
104
105 /// Creates a proxy that is identical to this proxy, except for the per-proxy context.
106 /// @param context The context for the new proxy.
107 /// @return A proxy with the new per-proxy context.
108 [[nodiscard]] Prx ice_context(Context context) const
109 {
110 return fromReference(asPrx()._context(std::move(context)));
111 }
112
113 /// Creates a proxy that is identical to this proxy, but uses datagram invocations.
114 /// @return A proxy that uses datagram invocations.
115 [[nodiscard]] Prx ice_datagram() const { return fromReference(asPrx()._datagram()); }
116
117 /// Creates a proxy that is identical to this proxy, except for the encoding used to marshal parameters.
118 /// @param version The encoding version to use to marshal request parameters.
119 /// @return A proxy with the specified encoding version.
120 [[nodiscard]] Prx ice_encodingVersion(EncodingVersion version) const
121 {
122 return fromReference(asPrx()._encodingVersion(version));
123 }
124
125 /// Creates a proxy that is identical to this proxy, except for the endpoint selection policy.
126 /// @param type The new endpoint selection policy.
127 /// @return A proxy with the specified endpoint selection policy.
128 [[nodiscard]] Prx ice_endpointSelection(EndpointSelectionType type) const
129 {
130 return fromReference(asPrx()._endpointSelection(type));
131 }
132
133 /// Creates a proxy that is identical to this proxy, except for the endpoints.
134 /// @param endpoints The endpoints for the new proxy.
135 /// @return A proxy with the new endpoints.
136 [[nodiscard]] Prx ice_endpoints(EndpointSeq endpoints) const
137 {
138 return fromReference(asPrx()._endpoints(std::move(endpoints)));
139 }
140
141 /// Creates a proxy that is identical to this proxy, except it's a fixed proxy bound to the given connection.
142 /// @param connection The fixed proxy connection.
143 /// @return A fixed proxy bound to the given connection.
144 [[nodiscard]] Prx ice_fixed(ConnectionPtr connection) const
145 {
146 return fromReference(asPrx()._fixed(std::move(connection)));
147 }
148
149 /// Creates a proxy that is identical to this proxy, except for the invocation timeout.
150 /// @param timeout The new invocation timeout (in milliseconds). Any negative value means infinite and is
151 /// normalized to -1.
152 /// @return A proxy with the new timeout.
153 [[nodiscard]] Prx ice_invocationTimeout(int timeout) const
154 {
155 return ice_invocationTimeout(std::chrono::milliseconds(timeout));
156 }
157
158 /// Creates a proxy that is identical to this proxy, except for the invocation timeout.
159 /// @param timeout The new invocation timeout. Any negative duration means infinite and is normalized to
160 /// -1 millisecond; a duration that is not a whole number of milliseconds is rounded up to the next whole
161 /// number of milliseconds.
162 /// @return A proxy with the new timeout.
163 /// @throws std::invalid_argument Thrown when @p timeout is greater than
164 /// `std::numeric_limits<std::int32_t>::max()` milliseconds.
165 template<class Rep, class Period>
166 [[nodiscard]] Prx ice_invocationTimeout(const std::chrono::duration<Rep, Period>& timeout) const
167 {
168 if (timeout < std::chrono::duration<Rep, Period>::zero())
169 {
170 return fromReference(asPrx()._invocationTimeout(std::chrono::milliseconds(-1)));
171 }
172 // Compare in a double-based representation that cannot overflow. The limit is a whole number of
173 // milliseconds, so a timeout that passes this check still fits after rounding up.
174 // The extra parentheses prevent the expansion of the max macro from Windows headers.
175 if (timeout > std::chrono::duration<double, std::milli>{(std::numeric_limits<std::int32_t>::max)()})
176 {
177 throw std::invalid_argument("the invocation timeout cannot be greater than 2147483647 milliseconds");
178 }
179 return fromReference(asPrx()._invocationTimeout(std::chrono::ceil<std::chrono::milliseconds>(timeout)));
180 }
181
182 /// Creates a proxy that is identical to this proxy, except for the locator.
183 /// @param locator The locator for the new proxy.
184 /// @return A proxy with the specified locator.
185 [[nodiscard]] Prx ice_locator(const std::optional<LocatorPrx>& locator) const
186 {
187 return fromReference(asPrx()._locator(locator));
188 }
189
190 /// Creates a proxy that is identical to this proxy, except for the locator cache timeout.
191 /// @param timeout The new locator cache timeout (in seconds). Any negative value means infinite and is
192 /// normalized to -1.
193 /// @return A proxy with the new timeout.
194 [[nodiscard]] Prx ice_locatorCacheTimeout(int timeout) const
195 {
196 return ice_locatorCacheTimeout(std::chrono::seconds(timeout));
197 }
198
199 /// Creates a proxy that is identical to this proxy, except for the locator cache timeout.
200 /// @param timeout The new locator cache timeout. Any negative duration means infinite and is normalized to
201 /// -1 second; a duration that is not a whole number of seconds is rounded up to the next whole number of
202 /// seconds.
203 /// @return A proxy with the new timeout.
204 /// @throws std::invalid_argument Thrown when @p timeout is greater than
205 /// `std::numeric_limits<std::int32_t>::max()` seconds.
206 template<class Rep, class Period>
207 [[nodiscard]] Prx ice_locatorCacheTimeout(const std::chrono::duration<Rep, Period>& timeout) const
208 {
209 if (timeout < std::chrono::duration<Rep, Period>::zero())
210 {
211 return fromReference(asPrx()._locatorCacheTimeout(std::chrono::seconds(-1)));
212 }
213 // Compare in a double-based representation that cannot overflow. The limit is a whole number of
214 // seconds, so a timeout that passes this check still fits after rounding up.
215 // The extra parentheses prevent the expansion of the max macro from Windows headers.
216 if (timeout > std::chrono::duration<double>{(std::numeric_limits<std::int32_t>::max)()})
217 {
218 throw std::invalid_argument("the locator cache timeout cannot be greater than 2147483647 seconds");
219 }
220 return fromReference(asPrx()._locatorCacheTimeout(std::chrono::ceil<std::chrono::seconds>(timeout)));
221 }
222
223 /// Creates a proxy that is identical to this proxy, but uses oneway invocations.
224 /// @return A proxy that uses oneway invocations.
225 [[nodiscard]] Prx ice_oneway() const { return fromReference(asPrx()._oneway()); }
226
227 /// Creates a proxy that is identical to this proxy, except for the router.
228 /// @param router The router for the new proxy.
229 /// @return A proxy with the specified router.
230 [[nodiscard]] Prx ice_router(const std::optional<RouterPrx>& router) const
231 {
232 return fromReference(asPrx()._router(router));
233 }
234
235 /// Creates a proxy that is identical to this proxy, but uses twoway invocations.
236 /// @return A proxy that uses twoway invocations.
237 [[nodiscard]] Prx ice_twoway() const { return fromReference(asPrx()._twoway()); }
238
239 protected:
240 /// @cond INTERNAL
241
242 // This constructor never initializes the base classes since they are all virtual and Proxy is never the most
243 // derived class.
244 Proxy() = default;
245
246 // The copy constructor and assignment operators are to keep GCC happy.
247 Proxy(const Proxy&) noexcept = default;
248 Proxy& operator=(const Proxy&) noexcept { return *this; } // NOLINT
249 Proxy& operator=(Proxy&&) noexcept { return *this; } // NOLINT
250 /// @endcond
251
252 private:
253 Prx fromReference(IceInternal::ReferencePtr&& ref) const
254 {
255 const Prx& self = asPrx();
256 return ref == self._reference ? self : Prx::_fromReference(std::move(ref));
257 }
258
259 [[nodiscard]] const Prx& asPrx() const noexcept { return *static_cast<const Prx*>(this); }
260 };
261
262 /// The base class for all Ice proxies.
263 /// @headerfile Ice/Ice.h
264 class ICE_API ObjectPrx : public Proxy<ObjectPrx>
265 {
266 public:
267 /// Copy constructor. Constructs with a copy of the contents of @p other.
268 /// @param other The proxy to copy from.
269 ObjectPrx(const ObjectPrx& other) noexcept = default;
270
271 /// Move constructor. Constructs a proxy with the contents of @p other using move semantics.
272 /// @param other The proxy to move from.
273 ObjectPrx(ObjectPrx&& other) noexcept = default;
274
275 /// Constructs a proxy from a Communicator and a proxy string.
276 /// @param communicator The communicator of the new proxy.
277 /// @param proxyString The proxy string to parse.
278 ObjectPrx(const Ice::CommunicatorPtr& communicator, std::string_view proxyString);
279
280 virtual ~ObjectPrx();
281
282 /// Copy assignment operator. Replaces the contents of this proxy with a copy of the contents of @p rhs.
283 /// @param rhs The proxy to copy from.
284 /// @return A reference to this proxy.
285 ObjectPrx& operator=(const ObjectPrx& rhs) noexcept = default;
286
287 /// Move assignment operator. Replaces the contents of this proxy with the contents of @p rhs using move
288 /// semantics.
289 /// @param rhs The proxy to move from.
290 /// @return A reference to this proxy.
291 ObjectPrx& operator=(ObjectPrx&& rhs) noexcept = default;
292
293 /// Tests whether this object supports a specific Slice interface.
294 /// @param typeId The type ID of the Slice interface to test against.
295 /// @param context The request context.
296 /// @return `true` if the target object implements the Slice interface specified by @p typeId or implements a
297 /// derived interface, `false` otherwise.
298 [[nodiscard]] bool ice_isA(std::string_view typeId, const Ice::Context& context = Ice::noExplicitContext) const;
299
300 /// Tests whether this object supports a specific Slice interface.
301 /// @param typeId The type ID of the Slice interface to test against.
302 /// @param response The response callback. The Ice runtime calls this function from an Ice thread pool thread.
303 /// If you set InitializationData::executor, the executor determines the thread that executes this function.
304 /// It accepts:
305 /// - `true` if the target object implements the Slice interface specified by @p typeId or implements a
306 /// derived interface, `false` otherwise.
307 /// @param ex The exception callback. The Ice runtime calls this function from an Ice thread pool thread. If
308 /// you set InitializationData::executor, the executor determines the thread that executes this function.
309 /// @param sent The sent callback. The Ice runtime calls this function when the request is accepted by the
310 /// transport. When the request is accepted synchronously, the Ice runtime calls this function from the current
311 /// thread and passes `true` as argument. When the request is accepted asynchronously, the Ice runtime calls
312 /// this function from an Ice thread pool thread and passes `false` as argument. If you set
313 /// InitializationData::executor, the executor determines the thread that executes this function in the
314 /// asynchronous case.
315 /// @param context The request context.
316 /// @return A function that can be called to cancel the invocation locally.
317 // NOLINTNEXTLINE(modernize-use-nodiscard)
318 std::function<void()> ice_isAAsync(
319 std::string_view typeId,
320 std::function<void(bool)> response,
321 std::function<void(std::exception_ptr)> ex = nullptr,
322 std::function<void(bool)> sent = nullptr,
323 const Ice::Context& context = Ice::noExplicitContext) const;
324
325 /// Tests whether this object supports a specific Slice interface.
326 /// @param typeId The type ID of the Slice interface to test against.
327 /// @param context The request context.
328 /// @return A future that becomes available when the invocation completes. This future holds:
329 /// - `true` if the target object implements the Slice interface specified by @p typeId or implements a
330 /// derived interface, `false` otherwise.
331 [[nodiscard]] std::future<bool>
332 ice_isAAsync(std::string_view typeId, const Ice::Context& context = Ice::noExplicitContext) const;
333
334 /// @private
335 void _iceI_isA(const std::shared_ptr<IceInternal::OutgoingAsyncT<bool>>&, std::string_view, const Ice::Context&)
336 const;
337
338 /// Tests whether the target object of this proxy can be reached.
339 /// @param context The request context.
340 void ice_ping(const Ice::Context& context = Ice::noExplicitContext) const;
341
342 /// Tests whether the target object of this proxy can be reached.
343 /// @param response The response callback. The Ice runtime calls this function from an Ice thread pool thread.
344 /// If you set InitializationData::executor, the executor determines the thread that executes this function.
345 /// @param ex The exception callback. The Ice runtime calls this function from an Ice thread pool thread. If
346 /// you set InitializationData::executor, the executor determines the thread that executes this function.
347 /// @param sent The sent callback. The Ice runtime calls this function when the request is accepted by the
348 /// transport. When the request is accepted synchronously, the Ice runtime calls this function from the current
349 /// thread and passes `true` as argument. When the request is accepted asynchronously, the Ice runtime calls
350 /// this function from an Ice thread pool thread and passes `false` as argument. If you set
351 /// InitializationData::executor, the executor determines the thread that executes this function in the
352 /// asynchronous case.
353 /// @param context The request context.
354 /// @return A function that can be called to cancel the invocation locally.
355 /// @remark When this proxy is a oneway or datagram proxy, the Ice runtime does not call the response
356 /// callback: a successful invocation completes with the sent callback. When this proxy is a batch proxy, this
357 /// function only adds the request to the batch: the Ice runtime calls none of the callbacks, and the request
358 /// is sent later, by a flush.
359 // NOLINTNEXTLINE(modernize-use-nodiscard)
360 std::function<void()> ice_pingAsync(
361 std::function<void()> response,
362 std::function<void(std::exception_ptr)> ex = nullptr,
363 std::function<void(bool)> sent = nullptr,
364 const Ice::Context& context = Ice::noExplicitContext) const;
365
366 /// Tests whether the target object of this proxy can be reached.
367 /// @param context The request context.
368 /// @return A future that becomes available when the response is received.
369 [[nodiscard]] std::future<void> ice_pingAsync(const Ice::Context& context = Ice::noExplicitContext) const;
370
371 /// @private
372 void _iceI_ping(const std::shared_ptr<IceInternal::OutgoingAsyncT<void>>&, const Ice::Context&) const;
373
374 /// Gets the Slice interfaces supported by this object as a list of Slice type IDs.
375 /// @param context The request context.
376 /// @return The Slice type IDs of the interfaces supported by this object, in alphabetical order.
377 [[nodiscard]] std::vector<std::string> ice_ids(const Ice::Context& context = Ice::noExplicitContext) const;
378
379 /// Gets the Slice interfaces supported by this object as a list of Slice type IDs.
380 /// @param response The response callback. The Ice runtime calls this function from an Ice thread pool thread.
381 /// If you set InitializationData::executor, the executor determines the thread that executes this function.
382 /// It accepts:
383 /// - The Slice type IDs of the interfaces supported by this object, in alphabetical order.
384 /// @param ex The exception callback. The Ice runtime calls this function from an Ice thread pool thread. If
385 /// you set InitializationData::executor, the executor determines the thread that executes this function.
386 /// @param sent The sent callback. The Ice runtime calls this function when the request is accepted by the
387 /// transport. When the request is accepted synchronously, the Ice runtime calls this function from the current
388 /// thread and passes `true` as argument. When the request is accepted asynchronously, the Ice runtime calls
389 /// this function from an Ice thread pool thread and passes `false` as argument. If you set
390 /// InitializationData::executor, the executor determines the thread that executes this function in the
391 /// asynchronous case.
392 /// @param context The request context.
393 /// @return A function that can be called to cancel the invocation locally.
394 // NOLINTNEXTLINE(modernize-use-nodiscard)
395 std::function<void()> ice_idsAsync(
396 std::function<void(std::vector<std::string>)> response,
397 std::function<void(std::exception_ptr)> ex = nullptr,
398 std::function<void(bool)> sent = nullptr,
399 const Ice::Context& context = Ice::noExplicitContext) const;
400
401 /// Gets the Slice interfaces supported by this object as a list of Slice type IDs.
402 /// @param context The request context.
403 /// @return A future that becomes available when the invocation completes. This future holds:
404 /// - The Slice type IDs of the interfaces supported by this object, in alphabetical order.
405 [[nodiscard]] std::future<std::vector<std::string>>
407
408 /// @private
409 void _iceI_ids(
410 const std::shared_ptr<IceInternal::OutgoingAsyncT<std::vector<std::string>>>&,
411 const Ice::Context&) const;
412
413 /// Gets the type ID of the most-derived Slice interface supported by this object.
414 /// @param context The request context.
415 /// @return The Slice type ID of the most-derived interface.
416 [[nodiscard]] std::string ice_id(const Ice::Context& context = Ice::noExplicitContext) const;
417
418 /// Gets the type ID of the most-derived Slice interface supported by this object.
419 /// @param response The response callback. The Ice runtime calls this function from an Ice thread pool thread.
420 /// If you set InitializationData::executor, the executor determines the thread that executes this function.
421 /// It accepts:
422 /// - The type ID of the most-derived interface.
423 /// @param ex The exception callback. The Ice runtime calls this function from an Ice thread pool thread. If
424 /// you set InitializationData::executor, the executor determines the thread that executes this function.
425 /// @param sent The sent callback. The Ice runtime calls this function when the request is accepted by the
426 /// transport. When the request is accepted synchronously, the Ice runtime calls this function from the current
427 /// thread and passes `true` as argument. When the request is accepted asynchronously, the Ice runtime calls
428 /// this function from an Ice thread pool thread and passes `false` as argument. If you set
429 /// InitializationData::executor, the executor determines the thread that executes this function in the
430 /// asynchronous case.
431 /// @param context The request context.
432 /// @return A function that can be called to cancel the invocation locally.
433 // NOLINTNEXTLINE(modernize-use-nodiscard)
434 std::function<void()> ice_idAsync(
435 std::function<void(std::string)> response,
436 std::function<void(std::exception_ptr)> ex = nullptr,
437 std::function<void(bool)> sent = nullptr,
438 const Ice::Context& context = Ice::noExplicitContext) const;
439
440 /// Gets the type ID of the most-derived Slice interface supported by this object.
441 /// @param context The request context.
442 /// @return A future that becomes available when the invocation completes. This future holds:
443 /// - The type ID of the most-derived interface.
444 [[nodiscard]] std::future<std::string> ice_idAsync(const Ice::Context& context = Ice::noExplicitContext) const;
445
446 /// @private
447 void _iceI_id(const std::shared_ptr<IceInternal::OutgoingAsyncT<std::string>>&, const Ice::Context&) const;
448
449 /// Invokes an operation.
450 /// @param operation The name of the operation to invoke.
451 /// @param mode The operation mode (normal or idempotent).
452 /// @param inParams An encapsulation containing the encoded in-parameters for the operation.
453 /// @param outParams An encapsulation containing the encoded result.
454 /// @param context The request context.
455 /// @return `true` if the operation completed successfully, `false` if it completed with a user exception.
457 std::string_view operation,
459 const std::vector<std::byte>& inParams,
460 std::vector<std::byte>& outParams,
461 const Ice::Context& context = Ice::noExplicitContext) const;
462
463 /// Invokes an operation asynchronously.
464 /// @param operation The name of the operation to invoke.
465 /// @param mode The operation mode (normal or idempotent).
466 /// @param inParams An encapsulation containing the encoded in-parameters for the operation.
467 /// @param context The request context.
468 /// @return A future that becomes available when the invocation completes. This future holds:
469 /// - `returnValue` `true` if the operation completed successfully, `false` if it completed with a user
470 /// exception.
471 /// - `outParams` An encapsulation containing the encoded result.
472 [[nodiscard]] std::future<std::tuple<bool, std::vector<std::byte>>> ice_invokeAsync(
473 std::string_view operation,
475 const std::vector<std::byte>& inParams,
476 const Ice::Context& context = Ice::noExplicitContext) const;
477
478 /// Invokes an operation asynchronously.
479 /// @param operation The name of the operation to invoke.
480 /// @param mode The operation mode (normal or idempotent).
481 /// @param inParams An encapsulation containing the encoded in-parameters for the operation.
482 /// @param response The response callback. The Ice runtime calls this function from an Ice thread pool thread.
483 /// If you set InitializationData::executor, the executor determines the thread that executes this function.
484 /// It accepts:
485 /// - `returnValue` `true` if the operation completed successfully, `false` if it completed with a user
486 /// exception.
487 /// - `outParams` An encapsulation containing the encoded result.
488 /// @param ex The exception callback. The Ice runtime calls this function from an Ice thread pool thread. If
489 /// you set InitializationData::executor, the executor determines the thread that executes this function.
490 /// @param sent The sent callback. The Ice runtime calls this function when the request is accepted by the
491 /// transport. When the request is accepted synchronously, the Ice runtime calls this function from the current
492 /// thread and passes `true` as argument. When the request is accepted asynchronously, the Ice runtime calls
493 /// this function from an Ice thread pool thread and passes `false` as argument. If you set
494 /// InitializationData::executor, the executor determines the thread that executes this function in the
495 /// asynchronous case.
496 /// @param context The request context.
497 /// @return A function that can be called to cancel the invocation locally.
498 /// @remark When this proxy is a oneway or datagram proxy, the Ice runtime does not call the response
499 /// callback: a successful invocation completes with the sent callback. When this proxy is a batch proxy, this
500 /// function only adds the request to the batch: the Ice runtime calls none of the callbacks, and the request
501 /// is sent later, by a flush.
502 // NOLINTNEXTLINE(modernize-use-nodiscard)
503 std::function<void()> ice_invokeAsync(
504 std::string_view operation,
506 const std::vector<std::byte>& inParams,
507 std::function<void(bool, std::vector<std::byte>)> response,
508 std::function<void(std::exception_ptr)> ex = nullptr,
509 std::function<void(bool)> sent = nullptr,
510 const Ice::Context& context = Ice::noExplicitContext) const;
511
512 /// Invokes an operation.
513 /// @param operation The name of the operation to invoke.
514 /// @param mode The operation mode (normal or idempotent).
515 /// @param inParams An encapsulation containing the encoded in-parameters for the operation.
516 /// @param outParams An encapsulation containing the encoded result.
517 /// @param context The request context.
518 /// @return `true` if the operation completed successfully, `false` if it completed with a user exception.
520 std::string_view operation,
522 std::pair<const std::byte*, const std::byte*> inParams,
523 std::vector<std::byte>& outParams,
524 const Ice::Context& context = Ice::noExplicitContext) const;
525
526 /// Invokes an operation asynchronously.
527 /// @param operation The name of the operation to invoke.
528 /// @param mode The operation mode (normal or idempotent).
529 /// @param inParams An encapsulation containing the encoded in-parameters for the operation.
530 /// @param context The request context.
531 /// @return A future that becomes available when the invocation completes. This future holds:
532 /// - `returnValue` `true` if the operation completed successfully, `false` if it completed with a user
533 /// exception.
534 /// - `outParams` An encapsulation containing the encoded result.
535 [[nodiscard]] std::future<std::tuple<bool, std::vector<std::byte>>> ice_invokeAsync(
536 std::string_view operation,
538 std::pair<const std::byte*, const std::byte*> inParams,
539 const Ice::Context& context = Ice::noExplicitContext) const;
540
541 /// Invokes an operation asynchronously.
542 /// @param operation The name of the operation to invoke.
543 /// @param mode The operation mode (normal or idempotent).
544 /// @param inParams An encapsulation containing the encoded in-parameters for the operation.
545 /// @param response The response callback. The Ice runtime calls this function from an Ice thread pool thread.
546 /// If you set InitializationData::executor, the executor determines the thread that executes this function.
547 /// It accepts:
548 /// - `returnValue` `true` if the operation completed successfully, `false` if it completed with a user
549 /// exception.
550 /// - `outParams` An encapsulation containing the encoded result.
551 /// @param ex The exception callback. The Ice runtime calls this function from an Ice thread pool thread. If
552 /// you set InitializationData::executor, the executor determines the thread that executes this function.
553 /// @param sent The sent callback. The Ice runtime calls this function when the request is accepted by the
554 /// transport. When the request is accepted synchronously, the Ice runtime calls this function from the current
555 /// thread and passes `true` as argument. When the request is accepted asynchronously, the Ice runtime calls
556 /// this function from an Ice thread pool thread and passes `false` as argument. If you set
557 /// InitializationData::executor, the executor determines the thread that executes this function in the
558 /// asynchronous case.
559 /// @param context The request context.
560 /// @return A function that can be called to cancel the invocation locally.
561 /// @remark When this proxy is a oneway or datagram proxy, the Ice runtime does not call the response
562 /// callback: a successful invocation completes with the sent callback. When this proxy is a batch proxy, this
563 /// function only adds the request to the batch: the Ice runtime calls none of the callbacks, and the request
564 /// is sent later, by a flush.
565 // NOLINTNEXTLINE(modernize-use-nodiscard)
566 std::function<void()> ice_invokeAsync(
567 std::string_view operation,
569 std::pair<const std::byte*, const std::byte*> inParams,
570 std::function<void(bool, std::pair<const std::byte*, const std::byte*>)> response,
571 std::function<void(std::exception_ptr)> ex = nullptr,
572 std::function<void(bool)> sent = nullptr,
573 const Ice::Context& context = Ice::noExplicitContext) const;
574
575 /// Gets the connection for this proxy. If the proxy does not yet have an established connection or its
576 /// connection is closed or being closed, it first attempts to create a new connection. For a fixed proxy,
577 /// this function returns the connection this proxy is bound to, even when this connection is closed.
578 /// @return The connection for this proxy.
579 /// @remark You can call this function to establish a connection or associate the proxy with an existing
580 /// connection and ignore the return value.
581 Ice::ConnectionPtr ice_getConnection() const; // NOLINT(modernize-use-nodiscard)
582
583 /// Gets the connection for this proxy. If the proxy does not yet have an established connection or its
584 /// connection is closed or being closed, it first attempts to create a new connection. For a fixed proxy,
585 /// this function returns the connection this proxy is bound to, even when this connection is closed.
586 /// @param response The response callback. The Ice runtime calls this function from an Ice thread pool thread.
587 /// If you set InitializationData::executor, the executor determines the thread that executes this function.
588 /// It accepts:
589 /// - The connection for this proxy.
590 /// @param ex The exception callback. The Ice runtime calls this function from an Ice thread pool thread. If
591 /// you set InitializationData::executor, the executor determines the thread that executes this function.
592 /// @param sent The sent callback. The Ice runtime never calls this function: no request is sent to get a
593 /// connection.
594 /// @return A function that can be called to cancel the invocation locally.
595 // NOLINTNEXTLINE(modernize-use-nodiscard)
596 std::function<void()> ice_getConnectionAsync(
597 std::function<void(Ice::ConnectionPtr)> response,
598 std::function<void(std::exception_ptr)> ex = nullptr,
599 std::function<void(bool)> sent = nullptr) const;
600
601 /// Gets the connection for this proxy. If the proxy does not yet have an established connection or its
602 /// connection is closed or being closed, it first attempts to create a new connection. For a fixed proxy,
603 /// this function returns the connection this proxy is bound to, even when this connection is closed.
604 /// @return A future that becomes available when the invocation completes. This future holds:
605 /// - The connection for this proxy.
606 [[nodiscard]] std::future<Ice::ConnectionPtr> ice_getConnectionAsync() const;
607
608 /// @private
609 void _iceI_getConnection(const std::shared_ptr<IceInternal::ProxyGetConnection>&) const;
610
611 /// Gets the cached Connection for this proxy. If the proxy does not yet have an established connection, it does
612 /// not attempt to create a connection. For a fixed proxy, this function returns the connection this proxy is
613 /// bound to, even when this connection is closed.
614 /// @return The cached connection for this proxy, or nullptr if the proxy does not have a cached connection.
615 /// The returned connection can be closed.
616 [[nodiscard]] Ice::ConnectionPtr ice_getCachedConnection() const noexcept;
617
618 /// Flushes any pending batched requests for this proxy. The call blocks until the flush is complete.
620
621 /// Flushes any pending batched requests for this proxy asynchronously.
622 /// @param ex The exception callback. The Ice runtime calls this function from an Ice thread pool thread. If
623 /// you set InitializationData::executor, the executor determines the thread that executes this function.
624 /// @param sent The sent callback. The Ice runtime calls this function when the batch requests are accepted
625 /// by the transport. When the batch requests are accepted synchronously, the Ice runtime calls this function
626 /// from the current thread and passes `true` as argument. When the batch requests are accepted asynchronously,
627 /// the Ice runtime calls this function from an Ice thread pool thread and passes `false` as argument. If you
628 /// set InitializationData::executor, the executor determines the thread that executes this function in the
629 /// asynchronous case.
630 /// @return A function that can be called to cancel the invocation locally.
631 // NOLINTNEXTLINE(modernize-use-nodiscard)
632 std::function<void()> ice_flushBatchRequestsAsync(
633 std::function<void(std::exception_ptr)> ex,
634 std::function<void(bool)> sent = nullptr) const;
635
636 /// Flushes any pending batched requests for this proxy asynchronously.
637 /// @return A future that becomes available when the flush completes.
638 [[nodiscard]] std::future<void> ice_flushBatchRequestsAsync() const;
639
640 /// Gets the identity embedded in this proxy.
641 /// @return The identity of the target object.
642 [[nodiscard]] const Ice::Identity& ice_getIdentity() const noexcept;
643
644 /// Creates a proxy that is identical to this proxy, except for the identity.
645 /// @param id The identity for the new proxy.
646 /// @return A proxy with the new identity.
647 template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
648 [[nodiscard]] Prx ice_identity(Ice::Identity id) const
649 {
650 return Prx::_fromReference(_identity(std::move(id)));
651 }
652
653 /// Gets the per-proxy context for this proxy.
654 /// @return The per-proxy context.
655 [[nodiscard]] Ice::Context ice_getContext() const;
656
657 /// Gets the facet for this proxy.
658 /// @return The facet for this proxy. If the proxy uses the default facet, the return value is the empty string.
659 [[nodiscard]] const std::string& ice_getFacet() const noexcept;
660
661 /// Creates a proxy that is identical to this proxy, except for the facet.
662 /// @param facet The facet for the new proxy.
663 /// @return A proxy with the new facet.
664 template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
665 [[nodiscard]] Prx ice_facet(std::string facet) const
666 {
667 return Prx::_fromReference(_facet(std::move(facet)));
668 }
669
670 /// Gets the adapter ID for this proxy.
671 /// @return The adapter ID. If the proxy does not have an adapter ID, the return value is the empty string.
672 [[nodiscard]] std::string ice_getAdapterId() const;
673
674 /// Gets the endpoints used by this proxy.
675 /// @return The endpoints used by this proxy.
676 [[nodiscard]] Ice::EndpointSeq ice_getEndpoints() const;
677
678 /// Gets the locator cache timeout of this proxy.
679 /// @return The locator cache timeout value.
680 [[nodiscard]] std::chrono::milliseconds ice_getLocatorCacheTimeout() const noexcept;
681
682 /// Determines whether this proxy caches connections.
683 /// @return `true` if this proxy caches connections, `false` otherwise.
684 [[nodiscard]] bool ice_isConnectionCached() const noexcept;
685
686 /// Gets the endpoint selection policy for this proxy (randomly or ordered).
687 /// @return The endpoint selection policy.
688 [[nodiscard]] Ice::EndpointSelectionType ice_getEndpointSelection() const noexcept;
689
690 /// Gets the encoding version used to marshal request parameters.
691 /// @return The encoding version.
692 [[nodiscard]] Ice::EncodingVersion ice_getEncodingVersion() const noexcept;
693
694 /// Gets the router for this proxy.
695 /// @return The router for the proxy. If no router is configured for the proxy, the return value
696 /// is nullopt.
697 [[nodiscard]] std::optional<RouterPrx> ice_getRouter() const noexcept;
698
699 /// Gets the locator for this proxy.
700 /// @return The locator for this proxy. If no locator is configured, the return value is nullopt.
701 [[nodiscard]] std::optional<LocatorPrx> ice_getLocator() const noexcept;
702
703 /// Determines whether this proxy uses collocation optimization.
704 /// @return `true` if the proxy uses collocation optimization, `false` otherwise.
705 [[nodiscard]] bool ice_isCollocationOptimized() const noexcept;
706
707 /// Gets the invocation timeout of this proxy.
708 /// @return The invocation timeout value.
709 [[nodiscard]] std::chrono::milliseconds ice_getInvocationTimeout() const noexcept;
710
711 /// Determines whether this proxy uses twoway invocations.
712 /// @return `true` if this proxy uses twoway invocations, `false` otherwise.
713 [[nodiscard]] bool ice_isTwoway() const noexcept;
714
715 /// Determines whether this proxy uses oneway invocations.
716 /// @return `true` if this proxy uses oneway invocations, `false` otherwise.
717 [[nodiscard]] bool ice_isOneway() const noexcept;
718
719 /// Determines whether this proxy uses batch oneway invocations.
720 /// @return `true` if this proxy uses batch oneway invocations, `false` otherwise.
721 [[nodiscard]] bool ice_isBatchOneway() const noexcept;
722
723 /// Determines whether this proxy uses datagram invocations.
724 /// @return `true` if this proxy uses datagram invocations, `false` otherwise.
725 [[nodiscard]] bool ice_isDatagram() const noexcept;
726
727 /// Determines whether this proxy uses batch datagram invocations.
728 /// @return `true` if this proxy uses batch datagram invocations, `false` otherwise.
729 [[nodiscard]] bool ice_isBatchDatagram() const noexcept;
730
731 /// Gets the compression override setting of this proxy.
732 /// @return The compression override setting. If nullopt is returned, no override is set. Otherwise, `true`
733 /// if compression is enabled, `false` otherwise.
734 [[nodiscard]] std::optional<bool> ice_getCompress() const noexcept;
735
736 /// Gets the connection ID of this proxy.
737 /// @return The connection ID.
738 [[nodiscard]] std::string ice_getConnectionId() const;
739
740 /// Determines whether this proxy is a fixed proxy.
741 /// @return `true` if this proxy is a fixed proxy, `false` otherwise.
742 [[nodiscard]] bool ice_isFixed() const noexcept;
743
744 /// Returns the Slice type ID associated with this type.
745 /// @return The Slice type ID.
746 static const char* ice_staticId() noexcept;
747
748 /// Gets the communicator that created this proxy.
749 /// @return The communicator that created this proxy.
750 [[nodiscard]] Ice::CommunicatorPtr ice_getCommunicator() const noexcept;
751
752 /// Creates a stringified version of this proxy.
753 /// @return A stringified proxy.
754 [[nodiscard]] std::string ice_toString() const;
755
756 /// @private
757 void _iceI_flushBatchRequests(const std::shared_ptr<IceInternal::ProxyFlushBatchAsync>&) const;
758
759 /// @cond INTERNAL
760 static ObjectPrx _fromReference(IceInternal::ReferencePtr ref) { return ObjectPrx(std::move(ref)); }
761
762 [[nodiscard]] const IceInternal::ReferencePtr& _getReference() const noexcept { return _reference; }
763 [[nodiscard]] const IceInternal::RequestHandlerCachePtr& _getRequestHandlerCache() const noexcept
764 {
765 return _requestHandlerCache;
766 }
767
768 void _checkTwowayOnly(std::string_view) const;
769
770 [[nodiscard]] size_t _hash() const noexcept;
771
772 void _write(OutputStream&) const;
773
774 protected:
775 // This constructor is never called; it allows Proxy's default constructor to compile.
776 ObjectPrx() = default;
777
778 // The constructor used by _fromReference.
779 explicit ObjectPrx(IceInternal::ReferencePtr&&);
780 /// @endcond
781
782 private:
783 template<typename Prx, typename... Bases> friend class Proxy;
784
785 // Gets a reference with the specified setting; returns _reference if the setting is already set.
786 [[nodiscard]] IceInternal::ReferencePtr _adapterId(std::string) const;
787 [[nodiscard]] IceInternal::ReferencePtr _batchDatagram() const;
788 [[nodiscard]] IceInternal::ReferencePtr _batchOneway() const;
789 [[nodiscard]] IceInternal::ReferencePtr _collocationOptimized(bool) const;
790 [[nodiscard]] IceInternal::ReferencePtr _compress(bool) const;
791 [[nodiscard]] IceInternal::ReferencePtr _connectionCached(bool) const;
792 [[nodiscard]] IceInternal::ReferencePtr _connectionId(std::string) const;
793 [[nodiscard]] IceInternal::ReferencePtr _context(Context) const;
794 [[nodiscard]] IceInternal::ReferencePtr _datagram() const;
795 [[nodiscard]] IceInternal::ReferencePtr _encodingVersion(EncodingVersion) const;
796 [[nodiscard]] IceInternal::ReferencePtr _endpointSelection(EndpointSelectionType) const;
797 [[nodiscard]] IceInternal::ReferencePtr _endpoints(EndpointSeq) const;
798 [[nodiscard]] IceInternal::ReferencePtr _identity(Identity) const;
799 [[nodiscard]] IceInternal::ReferencePtr _facet(std::string) const;
800 [[nodiscard]] IceInternal::ReferencePtr _fixed(ConnectionPtr) const;
801 [[nodiscard]] IceInternal::ReferencePtr _invocationTimeout(std::chrono::milliseconds) const;
802 [[nodiscard]] IceInternal::ReferencePtr _locator(const std::optional<LocatorPrx>&) const;
803 [[nodiscard]] IceInternal::ReferencePtr _locatorCacheTimeout(std::chrono::milliseconds) const;
804 [[nodiscard]] IceInternal::ReferencePtr _oneway() const;
805 [[nodiscard]] IceInternal::ReferencePtr _router(const std::optional<RouterPrx>&) const;
806 [[nodiscard]] IceInternal::ReferencePtr _twoway() const;
807
808 // Only the assignment operators can change these fields. All other member functions must be const.
809 IceInternal::ReferencePtr _reference;
810 IceInternal::RequestHandlerCachePtr _requestHandlerCache;
811 };
812
813 /// Outputs the stringified version of a proxy to a stream.
814 /// @param os The output stream.
815 /// @param proxy The proxy to output.
816 /// @return The output stream.
817 ICE_API std::ostream& operator<<(std::ostream& os, const ObjectPrx& proxy);
818
819 /// Outputs the stringified version of a proxy to a stream.
820 /// @tparam Prx The proxy type.
821 /// @param os The output stream.
822 /// @param proxy The proxy to output.
823 /// @return The output stream.
824 template<typename Prx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
825 inline std::ostream& operator<<(std::ostream& os, const std::optional<Prx>& proxy)
826 {
827 if (proxy)
828 {
829 os << *proxy;
830 }
831 else
832 {
833 os << "";
834 }
835 return os;
836 }
837}
838
839namespace std
840{
841 /// Specialization of std::hash for Ice::ObjectPrx.
842 template<> struct hash<Ice::ObjectPrx>
843 {
844 std::size_t operator()(const Ice::ObjectPrx& p) const noexcept { return p._hash(); }
845 };
846}
847
848#endif
Client applications use the Locator object to resolve Ice indirect proxies.
Definition Locator.h:39
bool ice_isFixed() const noexcept
Determines whether this proxy is a fixed proxy.
std::string ice_getConnectionId() const
Gets the connection ID of this proxy.
const std::string & ice_getFacet() const noexcept
Gets the facet for this proxy.
std::vector< std::string > ice_ids(const Ice::Context &context=Ice::noExplicitContext) const
Gets the Slice interfaces supported by this object as a list of Slice type IDs.
ObjectPrx(ObjectPrx &&other) noexcept=default
Move constructor.
bool ice_isTwoway() const noexcept
Determines whether this proxy uses twoway invocations.
bool ice_isA(std::string_view typeId, const Ice::Context &context=Ice::noExplicitContext) const
Tests whether this object supports a specific Slice interface.
void ice_ping(const Ice::Context &context=Ice::noExplicitContext) const
Tests whether the target object of this proxy can be reached.
std::string ice_toString() const
Creates a stringified version of this proxy.
ObjectPrx & operator=(ObjectPrx &&rhs) noexcept=default
Move assignment operator.
std::future< void > ice_pingAsync(const Ice::Context &context=Ice::noExplicitContext) const
Tests whether the target object of this proxy can be reached.
Prx ice_identity(Ice::Identity id) const
Creates a proxy that is identical to this proxy, except for the identity.
Definition Proxy.h:648
ObjectPrx(const Ice::CommunicatorPtr &communicator, std::string_view proxyString)
Constructs a proxy from a Communicator and a proxy string.
std::function< void()> ice_idAsync(std::function< void(std::string)> response, std::function< void(std::exception_ptr)> ex=nullptr, std::function< void(bool)> sent=nullptr, const Ice::Context &context=Ice::noExplicitContext) const
Gets the type ID of the most-derived Slice interface supported by this object.
Ice::Context ice_getContext() const
Gets the per-proxy context for this proxy.
std::chrono::milliseconds ice_getInvocationTimeout() const noexcept
Gets the invocation timeout of this proxy.
Ice::CommunicatorPtr ice_getCommunicator() const noexcept
Gets the communicator that created this proxy.
Ice::ConnectionPtr ice_getCachedConnection() const noexcept
Gets the cached Connection for this proxy.
Ice::ConnectionPtr ice_getConnection() const
Gets the connection for this proxy.
std::future< std::tuple< bool, std::vector< std::byte > > > ice_invokeAsync(std::string_view operation, Ice::OperationMode mode, const std::vector< std::byte > &inParams, const Ice::Context &context=Ice::noExplicitContext) const
Invokes an operation asynchronously.
bool ice_invoke(std::string_view operation, Ice::OperationMode mode, std::pair< const std::byte *, const std::byte * > inParams, std::vector< std::byte > &outParams, const Ice::Context &context=Ice::noExplicitContext) const
Invokes an operation.
void ice_flushBatchRequests() const
Flushes any pending batched requests for this proxy. The call blocks until the flush is complete.
bool ice_isConnectionCached() const noexcept
Determines whether this proxy caches connections.
bool ice_isBatchOneway() const noexcept
Determines whether this proxy uses batch oneway invocations.
std::function< void()> ice_flushBatchRequestsAsync(std::function< void(std::exception_ptr)> ex, std::function< void(bool)> sent=nullptr) const
Flushes any pending batched requests for this proxy asynchronously.
std::function< void()> ice_idsAsync(std::function< void(std::vector< std::string >)> response, std::function< void(std::exception_ptr)> ex=nullptr, std::function< void(bool)> sent=nullptr, const Ice::Context &context=Ice::noExplicitContext) const
Gets the Slice interfaces supported by this object as a list of Slice type IDs.
std::future< std::tuple< bool, std::vector< std::byte > > > ice_invokeAsync(std::string_view operation, Ice::OperationMode mode, std::pair< const std::byte *, const std::byte * > inParams, const Ice::Context &context=Ice::noExplicitContext) const
Invokes an operation asynchronously.
bool ice_isBatchDatagram() const noexcept
Determines whether this proxy uses batch datagram invocations.
std::function< void()> ice_getConnectionAsync(std::function< void(Ice::ConnectionPtr)> response, std::function< void(std::exception_ptr)> ex=nullptr, std::function< void(bool)> sent=nullptr) const
Gets the connection for this proxy.
std::optional< LocatorPrx > ice_getLocator() const noexcept
Gets the locator for this proxy.
std::future< bool > ice_isAAsync(std::string_view typeId, const Ice::Context &context=Ice::noExplicitContext) const
Tests whether this object supports a specific Slice interface.
Ice::EncodingVersion ice_getEncodingVersion() const noexcept
Gets the encoding version used to marshal request parameters.
std::function< void()> ice_invokeAsync(std::string_view operation, Ice::OperationMode mode, std::pair< const std::byte *, const std::byte * > inParams, std::function< void(bool, std::pair< const std::byte *, const std::byte * >)> response, std::function< void(std::exception_ptr)> ex=nullptr, std::function< void(bool)> sent=nullptr, const Ice::Context &context=Ice::noExplicitContext) const
Invokes an operation asynchronously.
std::function< void()> ice_pingAsync(std::function< void()> response, std::function< void(std::exception_ptr)> ex=nullptr, std::function< void(bool)> sent=nullptr, const Ice::Context &context=Ice::noExplicitContext) const
Tests whether the target object of this proxy can be reached.
bool ice_isDatagram() const noexcept
Determines whether this proxy uses datagram invocations.
bool ice_isOneway() const noexcept
Determines whether this proxy uses oneway invocations.
ObjectPrx & operator=(const ObjectPrx &rhs) noexcept=default
Copy assignment operator.
std::string ice_id(const Ice::Context &context=Ice::noExplicitContext) const
Gets the type ID of the most-derived Slice interface supported by this object.
const Ice::Identity & ice_getIdentity() const noexcept
Gets the identity embedded in this proxy.
ObjectPrx(const ObjectPrx &other) noexcept=default
Copy constructor.
std::function< void()> ice_isAAsync(std::string_view typeId, std::function< void(bool)> response, std::function< void(std::exception_ptr)> ex=nullptr, std::function< void(bool)> sent=nullptr, const Ice::Context &context=Ice::noExplicitContext) const
Tests whether this object supports a specific Slice interface.
static const char * ice_staticId() noexcept
Returns the Slice type ID associated with this type.
std::optional< bool > ice_getCompress() const noexcept
Gets the compression override setting of this proxy.
Ice::EndpointSeq ice_getEndpoints() const
Gets the endpoints used by this proxy.
bool ice_isCollocationOptimized() const noexcept
Determines whether this proxy uses collocation optimization.
std::future< Ice::ConnectionPtr > ice_getConnectionAsync() const
Gets the connection for this proxy.
std::future< std::vector< std::string > > ice_idsAsync(const Ice::Context &context=Ice::noExplicitContext) const
Gets the Slice interfaces supported by this object as a list of Slice type IDs.
std::string ice_getAdapterId() const
Gets the adapter ID for this proxy.
Ice::EndpointSelectionType ice_getEndpointSelection() const noexcept
Gets the endpoint selection policy for this proxy (randomly or ordered).
std::optional< RouterPrx > ice_getRouter() const noexcept
Gets the router for this proxy.
bool ice_invoke(std::string_view operation, Ice::OperationMode mode, const std::vector< std::byte > &inParams, std::vector< std::byte > &outParams, const Ice::Context &context=Ice::noExplicitContext) const
Invokes an operation.
Prx ice_facet(std::string facet) const
Creates a proxy that is identical to this proxy, except for the facet.
Definition Proxy.h:665
std::function< void()> ice_invokeAsync(std::string_view operation, Ice::OperationMode mode, const std::vector< std::byte > &inParams, std::function< void(bool, std::vector< std::byte >)> response, std::function< void(std::exception_ptr)> ex=nullptr, std::function< void(bool)> sent=nullptr, const Ice::Context &context=Ice::noExplicitContext) const
Invokes an operation asynchronously.
std::future< std::string > ice_idAsync(const Ice::Context &context=Ice::noExplicitContext) const
Gets the type ID of the most-derived Slice interface supported by this object.
std::chrono::milliseconds ice_getLocatorCacheTimeout() const noexcept
Gets the locator cache timeout of this proxy.
The base class for all Ice proxies.
Definition Proxy.h:265
Represents a byte buffer used for marshaling data using the Slice encoding.
Prx ice_invocationTimeout(const std::chrono::duration< Rep, Period > &timeout) const
Creates a proxy that is identical to this proxy, except for the invocation timeout.
Definition Proxy.h:166
Prx ice_endpointSelection(EndpointSelectionType type) const
Creates a proxy that is identical to this proxy, except for the endpoint selection policy.
Definition Proxy.h:128
Prx ice_locatorCacheTimeout(int timeout) const
Creates a proxy that is identical to this proxy, except for the locator cache timeout.
Definition Proxy.h:194
Prx ice_fixed(ConnectionPtr connection) const
Creates a proxy that is identical to this proxy, except it's a fixed proxy bound to the given connect...
Definition Proxy.h:144
Prx ice_encodingVersion(EncodingVersion version) const
Creates a proxy that is identical to this proxy, except for the encoding used to marshal parameters.
Definition Proxy.h:120
Prx ice_twoway() const
Creates a proxy that is identical to this proxy, but uses twoway invocations.
Definition Proxy.h:237
const Prx * operator->() const noexcept
The arrow operator.
Definition Proxy.h:58
Prx ice_invocationTimeout(int timeout) const
Creates a proxy that is identical to this proxy, except for the invocation timeout.
Definition Proxy.h:153
Prx ice_collocationOptimized(bool b) const
Creates a proxy that is identical to this proxy, except for collocation optimization.
Definition Proxy.h:81
Prx ice_batchOneway() const
Creates a proxy that is identical to this proxy, but uses batch oneway invocations.
Definition Proxy.h:76
Prx ice_compress(bool b) const
Creates a proxy that is identical to this proxy, except for its compression setting which overrides t...
Definition Proxy.h:90
Prx ice_connectionId(std::string id) const
Creates a proxy that is identical to this proxy, except for its connection ID.
Definition Proxy.h:100
Prx ice_context(Context context) const
Creates a proxy that is identical to this proxy, except for the per-proxy context.
Definition Proxy.h:108
Prx ice_datagram() const
Creates a proxy that is identical to this proxy, but uses datagram invocations.
Definition Proxy.h:115
Prx ice_batchDatagram() const
Creates a proxy that is identical to this proxy, but uses batch datagram invocations.
Definition Proxy.h:72
Prx ice_connectionCached(bool b) const
Creates a proxy that is identical to this proxy, except for connection caching.
Definition Proxy.h:95
Prx ice_router(const std::optional< RouterPrx > &router) const
Creates a proxy that is identical to this proxy, except for the router.
Definition Proxy.h:230
Prx ice_adapterId(std::string id) const
Creates a proxy that is identical to this proxy, except for the adapter ID.
Definition Proxy.h:65
Prx ice_locatorCacheTimeout(const std::chrono::duration< Rep, Period > &timeout) const
Creates a proxy that is identical to this proxy, except for the locator cache timeout.
Definition Proxy.h:207
Prx ice_locator(const std::optional< LocatorPrx > &locator) const
Creates a proxy that is identical to this proxy, except for the locator.
Definition Proxy.h:185
Prx ice_oneway() const
Creates a proxy that is identical to this proxy, but uses oneway invocations.
Definition Proxy.h:225
Prx ice_endpoints(EndpointSeq endpoints) const
Creates a proxy that is identical to this proxy, except for the endpoints.
Definition Proxy.h:136
Provides typed proxy functions.
Definition Proxy.h:48
Represents an intermediary object that routes requests and replies between clients and Ice objects th...
Definition Router.h:36
std::shared_ptr< Communicator > CommunicatorPtr
A shared pointer to a Communicator.
const Context noExplicitContext
Marker value used to indicate that no explicit request context was passed to a proxy invocation.
std::vector< EndpointPtr > EndpointSeq
A sequence of endpoints.
Definition EndpointF.h:41
EndpointSelectionType
Determines how the Ice runtime sorts proxy endpoints when establishing a connection.
OperationMode
Specifies if an operation is idempotent, which affects the retry behavior of the Ice client runtime.
std::shared_ptr< Connection > ConnectionPtr
A shared pointer to a Connection.
Definition ConnectionF.h:18
std::map< std::string, std::string, std::less<> > Context
Represents additional information carried by an Ice request.
Definition Context.h:28
The Ice RPC framework.
Definition SampleEvent.h:60
Represents a version of the Slice encoding.
Definition Version.h:68
Represents the identity of an Ice object.
Definition Identity.h:41