6#include "BatchRequestQueueF.h"
7#include "CommunicatorF.h"
10#include "EndpointSelectionType.h"
11#include "Ice/BuiltinSequences.h"
12#include "LocalExceptions.h"
13#include "ReferenceF.h"
14#include "RequestHandlerF.h"
26 class ProxyGetConnection;
27 class ProxyFlushBatchAsync;
29 template<
typename T>
class OutgoingAsyncT;
44 template<
typename Prx,
typename... Bases>
class Proxy :
public virtual Bases...
55 const Prx*
operator->() const noexcept {
return &asPrx(); }
64 return fromReference(asPrx()._adapterId(std::move(
id)));
69 [[nodiscard]] Prx
ice_batchDatagram()
const {
return fromReference(asPrx()._batchDatagram()); }
73 [[nodiscard]] Prx
ice_batchOneway()
const {
return fromReference(asPrx()._batchOneway()); }
80 return fromReference(asPrx()._collocationOptimized(b));
87 [[nodiscard]] Prx
ice_compress(
bool b)
const {
return fromReference(asPrx()._compress(b)); }
92 [[nodiscard]] Prx
ice_connectionCached(
bool b)
const {
return fromReference(asPrx()._connectionCached(b)); }
99 return fromReference(asPrx()._connectionId(std::move(
id)));
107 return fromReference(asPrx()._context(std::move(context)));
112 [[nodiscard]] Prx
ice_datagram()
const {
return fromReference(asPrx()._datagram()); }
119 return fromReference(asPrx()._encodingVersion(version));
127 return fromReference(asPrx()._endpointSelection(type));
135 return fromReference(asPrx()._endpoints(std::move(endpoints)));
143 return fromReference(asPrx()._fixed(std::move(connection)));
157 template<
class Rep,
class Period>
160 return fromReference(
161 asPrx()._invocationTimeout(std::chrono::duration_cast<std::chrono::milliseconds>(timeout)));
167 [[nodiscard]] Prx
ice_locator(
const std::optional<LocatorPrx>& locator)
const
169 return fromReference(asPrx()._locator(locator));
183 template<
class Rep,
class Period>
186 return fromReference(
187 asPrx()._locatorCacheTimeout(std::chrono::duration_cast<std::chrono::seconds>(timeout)));
192 [[nodiscard]] Prx
ice_oneway()
const {
return fromReference(asPrx()._oneway()); }
197 [[nodiscard]] Prx
ice_router(
const std::optional<RouterPrx>& router)
const
199 return fromReference(asPrx()._router(router));
204 [[nodiscard]] Prx
ice_twoway()
const {
return fromReference(asPrx()._twoway()); }
215 Proxy& operator=(
const Proxy&)
noexcept {
return *
this; }
216 Proxy& operator=(Proxy&&) noexcept {
return *
this; }
220 Prx fromReference(IceInternal::ReferencePtr&& ref)
const
222 const Prx& self = asPrx();
223 return ref == self._reference ? self : Prx::_fromReference(std::move(ref));
226 [[nodiscard]]
const Prx& asPrx() const noexcept {
return *
static_cast<const Prx*
>(
this); }
278 std::string_view typeId,
279 std::function<
void(
bool)> response,
280 std::function<
void(std::exception_ptr)> ex =
nullptr,
281 std::function<
void(
bool)> sent =
nullptr,
290 [[nodiscard]] std::future<bool>
294 void _iceI_isA(
const std::shared_ptr<IceInternal::OutgoingAsyncT<bool>>&, std::string_view,
const Ice::Context&)
309 std::function<
void()> response,
310 std::function<
void(std::exception_ptr)> ex =
nullptr,
311 std::function<
void(
bool)> sent =
nullptr,
320 void _iceI_ping(
const std::shared_ptr<IceInternal::OutgoingAsyncT<void>>&,
const Ice::Context&)
const;
336 std::function<
void(std::vector<std::string>)> response,
337 std::function<
void(std::exception_ptr)> ex =
nullptr,
338 std::function<
void(
bool)> sent =
nullptr,
345 [[nodiscard]] std::future<std::vector<std::string>>
350 const std::shared_ptr<IceInternal::OutgoingAsyncT<std::vector<std::string>>>&,
367 std::function<
void(std::string)> response,
368 std::function<
void(std::exception_ptr)> ex =
nullptr,
369 std::function<
void(
bool)> sent =
nullptr,
379 void _iceI_id(
const std::shared_ptr<IceInternal::OutgoingAsyncT<std::string>>&,
const Ice::Context&)
const;
389 std::string_view operation,
391 const std::vector<std::byte>& inParams,
392 std::vector<std::byte>& outParams,
405 std::string_view operation,
407 const std::vector<std::byte>& inParams,
424 std::string_view operation,
426 const std::vector<std::byte>& inParams,
427 std::function<
void(
bool, std::vector<std::byte>)> response,
428 std::function<
void(std::exception_ptr)> ex =
nullptr,
429 std::function<
void(
bool)> sent =
nullptr,
440 std::string_view operation,
442 std::pair<const std::byte*, const std::byte*> inParams,
443 std::vector<std::byte>& outParams,
456 std::string_view operation,
458 std::pair<const std::byte*, const std::byte*> inParams,
475 std::string_view operation,
477 std::pair<const std::byte*, const std::byte*> inParams,
478 std::function<
void(
bool, std::pair<const std::byte*, const std::byte*>)> response,
479 std::function<
void(std::exception_ptr)> ex =
nullptr,
480 std::function<
void(
bool)> sent =
nullptr,
500 std::function<
void(std::exception_ptr)> ex =
nullptr,
501 std::function<
void(
bool)> sent =
nullptr)
const;
510 void _iceI_getConnection(
const std::shared_ptr<IceInternal::ProxyGetConnection>&)
const;
527 std::function<
void(std::exception_ptr)> ex,
528 std::function<
void(
bool)> sent =
nullptr) const;
541 template<typename Prx =
ObjectPrx, std::enable_if_t<std::is_base_of_v<
ObjectPrx, Prx>,
bool> = true>
544 return Prx::_fromReference(_identity(std::move(
id)));
558 template<typename Prx =
ObjectPrx, std::enable_if_t<std::is_base_of_v<
ObjectPrx, Prx>,
bool> = true>
561 return Prx::_fromReference(_facet(std::move(facet)));
651 void _iceI_flushBatchRequests(const std::shared_ptr<IceInternal::ProxyFlushBatchAsync>&) const;
654 static
ObjectPrx _fromReference(IceInternal::ReferencePtr ref) {
return ObjectPrx(std::move(ref)); }
656 [[nodiscard]]
const IceInternal::ReferencePtr& _getReference() const noexcept {
return _reference; }
657 [[nodiscard]]
const IceInternal::RequestHandlerCachePtr& _getRequestHandlerCache() const noexcept
659 return _requestHandlerCache;
662 void _checkTwowayOnly(std::string_view)
const;
664 [[nodiscard]]
size_t _hash() const noexcept;
666 void _write(OutputStream&) const;
670 ObjectPrx() = default;
673 explicit ObjectPrx(IceInternal::ReferencePtr&&);
677 template<typename Prx, typename... Bases> friend class Proxy;
680 [[nodiscard]] IceInternal::ReferencePtr _adapterId(std::
string) const;
681 [[nodiscard]] IceInternal::ReferencePtr _batchDatagram() const;
682 [[nodiscard]] IceInternal::ReferencePtr _batchOneway() const;
683 [[nodiscard]] IceInternal::ReferencePtr _collocationOptimized(
bool) const;
684 [[nodiscard]] IceInternal::ReferencePtr _compress(
bool) const;
685 [[nodiscard]] IceInternal::ReferencePtr _connectionCached(
bool) const;
686 [[nodiscard]] IceInternal::ReferencePtr _connectionId(std::
string) const;
687 [[nodiscard]] IceInternal::ReferencePtr _context(Context) const;
688 [[nodiscard]] IceInternal::ReferencePtr _datagram() const;
689 [[nodiscard]] IceInternal::ReferencePtr _encodingVersion(EncodingVersion) const;
690 [[nodiscard]] IceInternal::ReferencePtr _endpointSelection(EndpointSelectionType) const;
691 [[nodiscard]] IceInternal::ReferencePtr _endpoints(EndpointSeq) const;
692 [[nodiscard]] IceInternal::ReferencePtr _identity(Identity) const;
693 [[nodiscard]] IceInternal::ReferencePtr _facet(std::
string) const;
694 [[nodiscard]] IceInternal::ReferencePtr _fixed(ConnectionPtr) const;
695 [[nodiscard]] IceInternal::ReferencePtr _invocationTimeout(std::chrono::milliseconds) const;
696 [[nodiscard]] IceInternal::ReferencePtr _locator(const std::optional<LocatorPrx>&) const;
697 [[nodiscard]] IceInternal::ReferencePtr _locatorCacheTimeout(std::chrono::milliseconds) const;
698 [[nodiscard]] IceInternal::ReferencePtr _oneway() const;
699 [[nodiscard]] IceInternal::ReferencePtr _router(const std::optional<RouterPrx>&) const;
700 [[nodiscard]] IceInternal::ReferencePtr _twoway() const;
703 IceInternal::ReferencePtr _reference;
704 IceInternal::RequestHandlerCachePtr _requestHandlerCache;
711 ICE_API std::ostream& operator<<(std::ostream& os, const
ObjectPrx& proxy);
718 template<typename Prx, std::enable_if_t<std::is_base_of_v<
ObjectPrx, Prx>,
bool> = true>
719 inline std::ostream& operator<<(std::ostream& os, const std::optional<Prx>& proxy)
736 template<>
struct hash<Ice::ObjectPrx>
738 std::size_t operator()(
const Ice::ObjectPrx& p)
const noexcept {
return p._hash(); }
Client applications use the Locator object to resolve Ice indirect proxies.
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 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.
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 communicator. The call blocks until the flush is comple...
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 asynchronously any pending batched requests for this communicator.
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 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 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.
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.
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.
Prx ice_endpointSelection(EndpointSelectionType type) const
Creates a proxy that is identical to this proxy, except for the endpoint selection policy.
Prx ice_locatorCacheTimeout(int timeout) const
Creates a proxy that is identical to this proxy, except for the locator cache timeout.
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...
Prx ice_encodingVersion(EncodingVersion version) const
Creates a proxy that is identical to this proxy, except for the encoding used to marshal parameters.
Prx ice_twoway() const
Creates a proxy that is identical to this proxy, but uses twoway invocations.
const Prx * operator->() const noexcept
The arrow operator.
Prx ice_invocationTimeout(int timeout) const
Creates a proxy that is identical to this proxy, except for the invocation timeout.
Prx ice_collocationOptimized(bool b) const
Creates a proxy that is identical to this proxy, except for collocation optimization.
Prx ice_batchOneway() const
Creates a proxy that is identical to this proxy, but uses batch oneway invocations.
Prx ice_compress(bool b) const
Creates a proxy that is identical to this proxy, except for its compression setting which overrides t...
Prx ice_connectionId(std::string id) const
Creates a proxy that is identical to this proxy, except for its connection ID.
Prx ice_context(Context context) const
Creates a proxy that is identical to this proxy, except for the per-proxy context.
Prx ice_datagram() const
Creates a proxy that is identical to this proxy, but uses datagram invocations.
Prx ice_batchDatagram() const
Creates a proxy that is identical to this proxy, but uses batch datagram invocations.
Prx ice_connectionCached(bool b) const
Creates a proxy that is identical to this proxy, except for connection caching.
Prx ice_router(const std::optional< RouterPrx > &router) const
Creates a proxy that is identical to this proxy, except for the router.
Prx ice_adapterId(std::string id) const
Creates a proxy that is identical to this proxy, except for the adapter ID.
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.
Prx ice_locator(const std::optional< LocatorPrx > &locator) const
Creates a proxy that is identical to this proxy, except for the locator.
Prx ice_oneway() const
Creates a proxy that is identical to this proxy, but uses oneway invocations.
Prx ice_endpoints(EndpointSeq endpoints) const
Creates a proxy that is identical to this proxy, except for the endpoints.
Provides typed proxy functions.
Represents an intermediary object that routes requests and replies between clients and Ice objects th...
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.
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.
std::map< std::string, std::string, std::less<> > Context
Represents additional information carried by an Ice request.
Represents a version of the Slice encoding.
Represents the identity of an Ice object.