diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2014-09-18 09:51:22 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2014-09-18 09:51:22 -0230 |
commit | 4723f7bbd3ea2ffb241df26e5736fa5c04589e7b (patch) | |
tree | 1fb506dbb4f76a5e6ce7e9eada7489e19a0560e4 /cpp/src/Ice/Proxy.cpp | |
parent | ICE-4891 some minor improvements (diff) | |
download | ice-4723f7bbd3ea2ffb241df26e5736fa5c04589e7b.tar.bz2 ice-4723f7bbd3ea2ffb241df26e5736fa5c04589e7b.tar.xz ice-4723f7bbd3ea2ffb241df26e5736fa5c04589e7b.zip |
ICE-5661 add proxy->begin_ice_getConnection
Diffstat (limited to 'cpp/src/Ice/Proxy.cpp')
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 720099b6927..9878f540035 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -40,6 +40,7 @@ const string ice_ids_name = "ice_ids"; const string ice_id_name = "ice_id"; const string ice_isA_name = "ice_isA"; const string ice_invoke_name = "ice_invoke"; +const string ice_getConnection_name = "ice_getConnection"; const string ice_flushBatchRequests_name = "ice_flushBatchRequests"; } @@ -472,6 +473,49 @@ IceProxy::Ice::Object::__begin_ice_invoke( return begin_ice_invoke(operation, mode, inParams, ctx, new Cpp11CB(response, exception, sent), 0); } +Ice::AsyncResultPtr +IceProxy::Ice::Object::begin_ice_getConnection( + const ::IceInternal::Function<void (const ::Ice::ConnectionPtr&)>& response, + const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception) +{ + class Cpp11CB : public ::IceInternal::Cpp11FnCallbackNC + { + public: + + Cpp11CB(const ::IceInternal::Function<void (const ::Ice::ConnectionPtr&)>& responseFunc, + const ::std::function<void (const ::Ice::Exception&)>& exceptionFunc) : + ::IceInternal::Cpp11FnCallbackNC(exceptionFunc, nullptr), + _response(responseFunc) + { + CallbackBase::checkCallback(true, responseFunc || exceptionFunc != nullptr); + } + + virtual void completed(const ::Ice::AsyncResultPtr& __result) const + { + ::Ice::ObjectPrx __proxy = ::Ice::ObjectPrx::uncheckedCast(__result->getProxy()); + ::Ice::ConnectionPtr __ret; + try + { + __ret = __proxy->end_ice_getConnection(__result); + } + catch(const ::Ice::Exception& ex) + { + Cpp11FnCallbackNC::exception(__result, ex); + return; + } + if(_response != nullptr) + { + _response(__ret); + } + } + + private: + + ::std::function<void (const ::Ice::ConnectionPtr&)> _response; + }; + return begin_ice_getConnectionInternal(new Cpp11CB(response, exception), 0); +} + #endif @@ -1440,6 +1484,31 @@ IceProxy::Ice::Object::ice_getConnection() } } +AsyncResultPtr +IceProxy::Ice::Object::begin_ice_getConnectionInternal(const ::IceInternal::CallbackBasePtr& del, + const ::Ice::LocalObjectPtr& cookie) +{ + ::IceInternal::GetConnectionOutgoingAsyncPtr __result = + new ::IceInternal::GetConnectionOutgoingAsync(this, ice_getConnection_name, del, cookie); + try + { + __result->__invoke(); + } + catch(const Exception& __ex) + { + __result->__invokeExceptionAsync(__ex); + } + return __result; +} + +ConnectionPtr +IceProxy::Ice::Object::end_ice_getConnection(const AsyncResultPtr& __result) +{ + AsyncResult::__check(__result, this, ice_getConnection_name); + __result->__wait(); + return ice_getCachedConnection(); +} + ConnectionPtr IceProxy::Ice::Object::ice_getCachedConnection() const { |