diff options
Diffstat (limited to 'cpp')
89 files changed, 531 insertions, 852 deletions
diff --git a/cpp/config/Make.rules b/cpp/config/Make.rules index bdd10c344b7..1cdcd1464d2 100644 --- a/cpp/config/Make.rules +++ b/cpp/config/Make.rules @@ -100,7 +100,7 @@ define make-cpp-src-project ifneq ($(USE_BIN_DIST),yes) $1_slicecompiler := slice2cpp $1_sliceflags += --ice -I$(slicedir) -$1_cppflags += -Isrc -I$1/generated -I$(includedir) -I$(includedir)/generated +$1_cppflags += -Isrc -I$1/generated -I$(includedir) -I$(includedir)/generated -DICE_BUILDING_SRC $(make-project) srcs:: $1 endif diff --git a/cpp/include/Glacier2/Application.h b/cpp/include/Glacier2/Application.h index c7ad39a0d7e..109a07e732e 100644 --- a/cpp/include/Glacier2/Application.h +++ b/cpp/include/Glacier2/Application.h @@ -23,7 +23,7 @@ namespace Glacier2 * This exception is raised if the session should be restarted. * **/ -class GLACIER2_API RestartSessionException : public IceUtil::Exception +class GLACIER2_API RestartSessionException : public IceUtil::ExceptionHelper<RestartSessionException> { public: @@ -31,7 +31,6 @@ public: #ifndef ICE_CPP11_MAPPING virtual RestartSessionException* ice_clone() const; #endif - virtual void ice_throw() const; }; /** diff --git a/cpp/include/Ice/CommunicatorAsync.h b/cpp/include/Ice/CommunicatorAsync.h index f93b9b9b960..549542567dd 100644 --- a/cpp/include/Ice/CommunicatorAsync.h +++ b/cpp/include/Ice/CommunicatorAsync.h @@ -10,9 +10,10 @@ #ifndef ICE_COMMUNICATOR_ASYNC_H #define ICE_COMMUNICATOR_ASYNC_H +#ifndef ICE_CPP11_MAPPING + #include <Ice/Communicator.h> -#ifndef ICE_CPP11_MAPPING namespace Ice { diff --git a/cpp/include/Ice/ConnectionAsync.h b/cpp/include/Ice/ConnectionAsync.h index cd1588191f7..ce9fd85e7af 100644 --- a/cpp/include/Ice/ConnectionAsync.h +++ b/cpp/include/Ice/ConnectionAsync.h @@ -10,13 +10,14 @@ #ifndef ICE_CONNECTION_ASYNC_H #define ICE_CONNECTION_ASYNC_H +#ifndef ICE_CPP11_MAPPING + #include <Ice/Connection.h> #include <Ice/Proxy.h> namespace Ice { -#ifndef ICE_CPP11_MAPPING template<class T> class CallbackNC_Connection_flushBatchRequests : public Callback_Connection_flushBatchRequests_Base, public ::IceInternal::OnewayCallbackNC<T> @@ -110,8 +111,8 @@ newCallback_Connection_flushBatchRequests(T* instance, void (T::*excb)(const ::I { return new Callback_Connection_flushBatchRequests<T, CT>(instance, excb, sentcb); } -#endif } #endif +#endif diff --git a/cpp/include/Ice/DispatchInterceptor.h b/cpp/include/Ice/DispatchInterceptor.h index 37051ef400e..63a0a5e96e2 100644 --- a/cpp/include/Ice/DispatchInterceptor.h +++ b/cpp/include/Ice/DispatchInterceptor.h @@ -26,7 +26,7 @@ public: __dispatch(IceInternal::Incoming&, const Current&); }; -typedef IceInternal::Handle<DispatchInterceptor> DispatchInterceptorPtr; +ICE_DEFINE_PTR(DispatchInterceptorPtr, DispatchInterceptor); } diff --git a/cpp/include/Ice/Dispatcher.h b/cpp/include/Ice/Dispatcher.h index 51dceba00c7..cb9a25c124e 100644 --- a/cpp/include/Ice/Dispatcher.h +++ b/cpp/include/Ice/Dispatcher.h @@ -10,6 +10,12 @@ #ifndef ICE_DISPATCHER_H #define ICE_DISPATCHER_H +#if !defined(ICE_CPP11_MAPPING) || defined(ICE_BUILDING_SRC) +// +// Part of the C++98 mapping, and "internal" definitions when building Ice +// with the C++11 mapping +// + #include <IceUtil/Config.h> #include <IceUtil/Shared.h> #include <IceUtil/Handle.h> @@ -43,3 +49,4 @@ typedef IceUtil::Handle<Dispatcher> DispatcherPtr; } #endif +#endif diff --git a/cpp/include/Ice/Exception.h b/cpp/include/Ice/Exception.h index d06f576aae3..b957a91be0c 100644 --- a/cpp/include/Ice/Exception.h +++ b/cpp/include/Ice/Exception.h @@ -51,28 +51,32 @@ public: virtual ~LocalException() throw(); #endif - static const std::string& ice_staticId(); - -#ifndef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_MAPPING + std::unique_ptr<LocalException> ice_clone() const; +#else virtual LocalException* ice_clone() const = 0; #endif + + static const std::string& ice_staticId(); }; class ICE_API UserException : public IceUtil::Exception { public: - static const std::string& ice_staticId(); - virtual void __write(::Ice::OutputStream*) const; virtual void __read(::Ice::InputStream*); virtual bool __usesClasses() const; -#ifndef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_MAPPING + std::unique_ptr<UserException> ice_clone() const; +#else virtual UserException* ice_clone() const = 0; #endif + static const std::string& ice_staticId(); + protected: virtual void __writeImpl(::Ice::OutputStream*) const {}; @@ -90,12 +94,13 @@ public: virtual ~SystemException() throw(); #endif - static const std::string& ice_staticId(); - -#ifndef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_MAPPING + std::unique_ptr<SystemException> ice_clone() const; +#else virtual SystemException* ice_clone() const = 0; #endif + static const std::string& ice_staticId(); }; } diff --git a/cpp/include/Ice/ExceptionHelpers.h b/cpp/include/Ice/ExceptionHelpers.h index e4dfa076f34..04c37669f07 100644 --- a/cpp/include/Ice/ExceptionHelpers.h +++ b/cpp/include/Ice/ExceptionHelpers.h @@ -20,43 +20,29 @@ namespace Ice class LocalException; -template<typename T, typename B> class LocalExceptionHelper : public B +template<typename T, typename B> class LocalExceptionHelper : public IceUtil::ExceptionHelper<T, B> { public: - using B::B; - - LocalExceptionHelper() = default; + using IceUtil::ExceptionHelper<T, B>::ExceptionHelper; virtual std::string ice_id() const override { return T::ice_staticId(); } - - virtual void ice_throw() const override - { - throw static_cast<const T&>(*this); - } }; -template<typename T, typename B> class UserExceptionHelper : public B +template<typename T, typename B> class UserExceptionHelper : public IceUtil::ExceptionHelper<T, B> { public: - using B::B; - - UserExceptionHelper() = default; + using IceUtil::ExceptionHelper<T, B>::ExceptionHelper; virtual std::string ice_id() const override { return T::ice_staticId(); } - virtual void ice_throw() const override - { - throw static_cast<const T&>(*this); - } - protected: virtual void __writeImpl(Ice::OutputStream* os) const override diff --git a/cpp/include/Ice/GCObject.h b/cpp/include/Ice/GCObject.h index 2e407ee32c9..e115795be20 100644 --- a/cpp/include/Ice/GCObject.h +++ b/cpp/include/Ice/GCObject.h @@ -10,13 +10,13 @@ #ifndef ICE_GC_OBJECT_H #define ICE_GC_OBJECT_H +#ifndef ICE_CPP11_MAPPING + #include <Ice/Object.h> #include <IceUtil/MutexPtrLock.h> #include <IceUtil/Mutex.h> -#ifndef ICE_CPP11_MAPPING - namespace IceInternal { diff --git a/cpp/include/Ice/LocalObject.h b/cpp/include/Ice/LocalObject.h index fd765e04f0a..01f17caf60f 100644 --- a/cpp/include/Ice/LocalObject.h +++ b/cpp/include/Ice/LocalObject.h @@ -10,6 +10,12 @@ #ifndef ICE_LOCAL_OBJECT_H #define ICE_LOCAL_OBJECT_H +#if !defined(ICE_CPP11_MAPPING) || defined(ICE_BUILDING_SRC) +// +// Part of the C++98 mapping, and "internal" definitions when building Ice +// with the C++11 mapping +// + #include <IceUtil/Shared.h> #include <Ice/LocalObjectF.h> @@ -27,3 +33,4 @@ public: } #endif +#endif diff --git a/cpp/include/Ice/Outgoing.h b/cpp/include/Ice/Outgoing.h index 5c03011e699..9bb0810e38f 100644 --- a/cpp/include/Ice/Outgoing.h +++ b/cpp/include/Ice/Outgoing.h @@ -66,11 +66,7 @@ protected: OutgoingBase(Instance*); Ice::OutputStream _os; -#ifdef ICE_CPP11_MAPPING - std::exception_ptr _exception; -#else IceUtil::UniquePtr<Ice::Exception> _exception; -#endif bool _sent; InvocationObserver _observer; ObserverHelperT<Ice::Instrumentation::ChildInvocationObserver> _childObserver; diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h index df204b6a350..0a2edead961 100644 --- a/cpp/include/Ice/OutgoingAsync.h +++ b/cpp/include/Ice/OutgoingAsync.h @@ -23,10 +23,10 @@ #include <Ice/InputStream.h> #include <Ice/ObserverHelper.h> #include <Ice/LocalException.h> +#include <IceUtil/UniquePtr.h> #ifndef ICE_CPP11_MAPPING # include <Ice/AsyncResult.h> -# include <IceUtil/UniquePtr.h> #endif #include <exception> @@ -163,16 +163,15 @@ protected: #ifdef ICE_CPP11_MAPPING std::mutex _m; using Lock = std::lock_guard<std::mutex>; - std::exception_ptr _ex; - std::exception_ptr _cancellationException; #else IceUtil::Monitor<IceUtil::Mutex> _m; typedef IceUtil::Monitor<IceUtil::Mutex>::Lock Lock; - IceUtil::UniquePtr<Ice::Exception> _ex; - IceUtil::UniquePtr<Ice::LocalException> _cancellationException; Ice::LocalObjectPtr _cookie; #endif + IceUtil::UniquePtr<Ice::Exception> _ex; + IceUtil::UniquePtr<Ice::LocalException> _cancellationException; + InvocationObserver _observer; ObserverHelperT<Ice::Instrumentation::ChildInvocationObserver> _childObserver; diff --git a/cpp/include/Ice/ProxyHandle.h b/cpp/include/Ice/ProxyHandle.h index 22b29213839..628fb2b460b 100644 --- a/cpp/include/Ice/ProxyHandle.h +++ b/cpp/include/Ice/ProxyHandle.h @@ -10,12 +10,13 @@ #ifndef ICE_PROXY_HANDLE_H #define ICE_PROXY_HANDLE_H +#ifndef ICE_CPP11_MAPPING // C++98 mapping + #include <IceUtil/Handle.h> #include <Ice/Config.h> #include <iosfwd> -#ifndef ICE_CPP11_MAPPING // C++98 mapping namespace IceInternal { diff --git a/cpp/include/IceSSL/Plugin.h b/cpp/include/IceSSL/Plugin.h index 3f15974a556..75cfa266d8b 100644 --- a/cpp/include/IceSSL/Plugin.h +++ b/cpp/include/IceSSL/Plugin.h @@ -81,7 +81,7 @@ namespace IceSSL // // This exception is thrown if the certificate cannot be read. // -class ICE_SSL_API CertificateReadException : public IceUtil::Exception +class ICE_SSL_API CertificateReadException : public IceUtil::ExceptionHelper<CertificateReadException> { public: @@ -93,7 +93,6 @@ public: #ifndef ICE_CPP11_MAPPING virtual CertificateReadException* ice_clone() const; #endif - virtual void ice_throw() const; std::string reason; @@ -105,7 +104,7 @@ private: // // This exception is thrown if the certificate cannot be encoded. // -class ICE_SSL_API CertificateEncodingException : public IceUtil::Exception +class ICE_SSL_API CertificateEncodingException : public IceUtil::ExceptionHelper<CertificateEncodingException> { public: @@ -120,7 +119,6 @@ public: #ifndef ICE_CPP11_MAPPING virtual CertificateEncodingException* ice_clone() const; #endif - virtual void ice_throw() const; std::string reason; @@ -132,7 +130,7 @@ private: // // This exception is thrown if a distinguished name cannot be parsed. // -class ICE_SSL_API ParseException : public IceUtil::Exception +class ICE_SSL_API ParseException : public IceUtil::ExceptionHelper<ParseException> { public: @@ -144,7 +142,6 @@ public: #ifndef ICE_CPP11_MAPPING virtual ParseException* ice_clone() const; #endif - virtual void ice_throw() const; std::string reason; diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index 6e8a2ea0b0c..a53cd04abd1 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -375,7 +375,7 @@ typedef long long Int64; # define ICE_HEARTBEAT_CALLBACK ::std::function<void(const ::std::shared_ptr<::Ice::Connection>&)> # define ICE_IN(...) __VA_ARGS__ # define ICE_EXCEPTION_ISSET(T) T -# define ICE_RETHROW_EXCEPTION(T) ::std::rethrow_exception(T) +# define ICE_RETHROW_EXCEPTION(T) T->ice_throw() # define ICE_RESET_EXCEPTION(T, V) T = V #else // C++98 mapping # define ICE_HANDLE ::IceUtil::Handle @@ -394,7 +394,7 @@ typedef long long Int64; # define ICE_CLOSE_CALLBACK ::Ice::CloseCallbackPtr # define ICE_HEARTBEAT_CALLBACK ::Ice::HeartbeatCallbackPtr # define ICE_IN(...) const __VA_ARGS__& -# define ICE_EXCEPTION_ISSET(T) (T.get() != 0) +# define ICE_EXCEPTION_ISSET(T) T # define ICE_RETHROW_EXCEPTION(T) T->ice_throw() # define ICE_RESET_EXCEPTION(T,V) T.reset(V) #endif diff --git a/cpp/include/IceUtil/CtrlCHandler.h b/cpp/include/IceUtil/CtrlCHandler.h index e5692d96990..0659033303a 100644 --- a/cpp/include/IceUtil/CtrlCHandler.h +++ b/cpp/include/IceUtil/CtrlCHandler.h @@ -55,16 +55,16 @@ public: CtrlCHandlerCallback getCallback() const; }; -class ICE_API CtrlCHandlerException : public Exception +class ICE_API CtrlCHandlerException : public ExceptionHelper<CtrlCHandlerException> { public: CtrlCHandlerException(const char*, int); virtual std::string ice_id() const; + #ifndef ICE_CPP11_MAPPING virtual CtrlCHandlerException* ice_clone() const; #endif - virtual void ice_throw() const; }; } diff --git a/cpp/include/IceUtil/Exception.h b/cpp/include/IceUtil/Exception.h index 2e9dd34af3f..e7e6a21a52f 100644 --- a/cpp/include/IceUtil/Exception.h +++ b/cpp/include/IceUtil/Exception.h @@ -25,13 +25,13 @@ public: Exception(); Exception(const char*, int); #ifndef ICE_CPP11_COMPILER - virtual ~Exception() throw(); + virtual ~Exception() throw() = 0; #endif virtual std::string ice_id() const = 0; virtual void ice_print(std::ostream&) const; virtual const char* what() const ICE_NOEXCEPT; #ifdef ICE_CPP11_MAPPING - std::exception_ptr ice_clone() const; + std::unique_ptr<Exception> ice_clone() const; #else virtual Exception* ice_clone() const = 0; ICE_DEPRECATED_API("ice_name() is deprecated, use ice_id() instead.") @@ -43,6 +43,12 @@ public: int ice_line() const; std::string ice_stackTrace() const; +protected: + +#ifdef ICE_CPP11_MAPPING + virtual Exception* ice_cloneImpl() const = 0; +#endif + private: const char* _file; @@ -53,36 +59,87 @@ private: ICE_API std::ostream& operator<<(std::ostream&, const Exception&); -class ICE_API NullHandleException : public Exception + +#ifdef ICE_CPP11_MAPPING + +template<typename E, typename B = Exception> +class ExceptionHelper : public B { public: - NullHandleException(const char*, int); -#ifndef ICE_CPP11_COMPILER - virtual ~NullHandleException() throw(); + using B::B; + + std::unique_ptr<E> ice_clone() const + { + return std::unique_ptr<E>(static_cast<E*>(ice_cloneImpl())); + } + + virtual void ice_throw() const override + { + throw static_cast<const E&>(*this); + } + +protected: + + virtual Exception* ice_cloneImpl() const override + { + return new E(static_cast<const E&>(*this)); + } +}; + +#else // C++98 mapping + +template<typename E> +class ExceptionHelper : public Exception +{ +public: + + ExceptionHelper() + { + } + + ExceptionHelper(const char* file, int line) : Exception(file, line) + { + } + + virtual void ice_throw() const + { + throw static_cast<const E&>(*this); + } +}; + #endif + + +class ICE_API NullHandleException : public ExceptionHelper<NullHandleException> +{ +public: + + NullHandleException(const char*, int); virtual std::string ice_id() const; + #ifndef ICE_CPP11_MAPPING virtual NullHandleException* ice_clone() const; #endif - virtual void ice_throw() const; }; -class ICE_API IllegalArgumentException : public Exception +class ICE_API IllegalArgumentException : public ExceptionHelper<IllegalArgumentException> { public: IllegalArgumentException(const char*, int); IllegalArgumentException(const char*, int, const std::string&); + #ifndef ICE_CPP11_COMPILER virtual ~IllegalArgumentException() throw(); #endif + virtual std::string ice_id() const; virtual void ice_print(std::ostream&) const; + #ifndef ICE_CPP11_MAPPING virtual IllegalArgumentException* ice_clone() const; #endif - virtual void ice_throw() const; std::string reason() const; @@ -94,40 +151,48 @@ private: // // IllegalConversionException is raised to report a string conversion error // -class ICE_API IllegalConversionException : public Exception +class ICE_API IllegalConversionException : public ExceptionHelper<IllegalConversionException> { public: IllegalConversionException(const char*, int); IllegalConversionException(const char*, int, const std::string&); + #ifndef ICE_CPP11_COMPILER virtual ~IllegalConversionException() throw(); #endif + virtual std::string ice_id() const; virtual void ice_print(std::ostream&) const; + #ifndef ICE_CPP11_MAPPING virtual IllegalConversionException* ice_clone() const; #endif - virtual void ice_throw() const; std::string reason() const; + private: const std::string _reason; }; -class ICE_API SyscallException : public Exception +class ICE_API SyscallException : public ExceptionHelper<SyscallException> { public: SyscallException(const char*, int, int); + +#ifndef ICE_CPP11_COMPILER + virtual ~SyscallException() throw(); +#endif + virtual std::string ice_id() const; virtual void ice_print(std::ostream&) const; + #ifndef ICE_CPP11_MAPPING virtual SyscallException* ice_clone() const; #endif - virtual void ice_throw() const; int error() const; @@ -136,20 +201,49 @@ private: const int _error; }; -class ICE_API FileLockException : public Exception + +#ifdef ICE_CPP11_MAPPING + +template<typename E> +using SyscallExceptionHelper = ExceptionHelper<E, SyscallException>; + +#else // C++98 mapping + +template<typename E> +class SyscallExceptionHelper : public SyscallException +{ +public: + + SyscallExceptionHelper(const char* file, int line, int errorCode) : + SyscallException(file, line, errorCode) + { + } + + virtual void ice_throw() const + { + throw static_cast<const E&>(*this); + } +}; + +#endif + + +class ICE_API FileLockException : public ExceptionHelper<FileLockException> { public: FileLockException(const char*, int, int, const std::string&); + #ifndef ICE_CPP11_COMPILER virtual ~FileLockException() throw(); #endif + virtual std::string ice_id() const; virtual void ice_print(std::ostream&) const; + #ifndef ICE_CPP11_MAPPING virtual FileLockException* ice_clone() const; #endif - virtual void ice_throw() const; std::string path() const; int error() const; @@ -160,36 +254,35 @@ private: std::string _path; }; -class ICE_API OptionalNotSetException : public Exception +class ICE_API OptionalNotSetException : public ExceptionHelper<OptionalNotSetException> { public: OptionalNotSetException(const char*, int); -#ifndef ICE_CPP11_COMPILER - virtual ~OptionalNotSetException() throw(); -#endif virtual std::string ice_id() const; + #ifndef ICE_CPP11_MAPPING virtual OptionalNotSetException* ice_clone() const; #endif - virtual void ice_throw() const; }; #ifndef _WIN32 -class ICE_API IconvInitializationException : public Exception +class ICE_API IconvInitializationException : public ExceptionHelper<IconvInitializationException> { public: IconvInitializationException(const char*, int, const std::string&); + #ifndef ICE_CPP11_COMPILER virtual ~IconvInitializationException() throw(); #endif + virtual std::string ice_id() const; virtual void ice_print(std::ostream&) const; + #ifndef ICE_CPP11_MAPPING virtual IconvInitializationException* ice_clone() const; #endif - virtual void ice_throw() const; std::string reason() const; diff --git a/cpp/include/IceUtil/Options.h b/cpp/include/IceUtil/Options.h index 63301165295..ffae862f88b 100644 --- a/cpp/include/IceUtil/Options.h +++ b/cpp/include/IceUtil/Options.h @@ -22,7 +22,7 @@ namespace IceUtilInternal { -class ICE_API APIException : public IceUtil::Exception +class ICE_API APIException : public IceUtil::ExceptionHelper<APIException> { public: @@ -35,14 +35,13 @@ public: #ifndef ICE_CPP11_MAPPING virtual APIException* ice_clone() const; #endif - virtual void ice_throw() const; ::std::string reason; }; ICE_API ::std::ostream& operator<<(::std::ostream&, const APIException&); -class ICE_API BadOptException : public IceUtil::Exception +class ICE_API BadOptException : public IceUtil::ExceptionHelper<BadOptException> { public: @@ -52,10 +51,10 @@ public: #endif virtual ::std::string ice_id() const; virtual void ice_print(std::ostream&) const; + #ifndef ICE_CPP11_MAPPING virtual BadOptException* ice_clone() const; #endif - virtual void ice_throw() const; ::std::string reason; }; diff --git a/cpp/include/IceUtil/ThreadException.h b/cpp/include/IceUtil/ThreadException.h index 8f380206d5c..2e0756938eb 100644 --- a/cpp/include/IceUtil/ThreadException.h +++ b/cpp/include/IceUtil/ThreadException.h @@ -16,77 +16,78 @@ namespace IceUtil { -class ICE_API ThreadSyscallException : public SyscallException +class ICE_API ThreadSyscallException : public SyscallExceptionHelper<ThreadSyscallException> { public: ThreadSyscallException(const char*, int, int); virtual std::string ice_id() const; + #ifndef ICE_CPP11_MAPPING virtual ThreadSyscallException* ice_clone() const; #endif - virtual void ice_throw() const; }; -class ICE_API ThreadLockedException : public Exception +class ICE_API ThreadLockedException : public ExceptionHelper<ThreadLockedException> { public: ThreadLockedException(const char*, int); virtual std::string ice_id() const; + #ifndef ICE_CPP11_MAPPING virtual ThreadLockedException* ice_clone() const; #endif - virtual void ice_throw() const; }; -class ICE_API ThreadStartedException : public Exception +class ICE_API ThreadStartedException : public ExceptionHelper<ThreadStartedException> { public: ThreadStartedException(const char*, int); virtual std::string ice_id() const; + #ifndef ICE_CPP11_MAPPING virtual ThreadStartedException* ice_clone() const; #endif - virtual void ice_throw() const; + }; -class ICE_API ThreadNotStartedException : public Exception +class ICE_API ThreadNotStartedException : public ExceptionHelper<ThreadNotStartedException> { public: ThreadNotStartedException(const char*, int); virtual std::string ice_id() const; + #ifndef ICE_CPP11_MAPPING virtual ThreadNotStartedException* ice_clone() const; #endif - virtual void ice_throw() const; }; -class ICE_API BadThreadControlException : public Exception +class ICE_API BadThreadControlException : public ExceptionHelper<BadThreadControlException> { public: BadThreadControlException(const char*, int); virtual std::string ice_id() const; + #ifndef ICE_CPP11_MAPPING virtual BadThreadControlException* ice_clone() const; #endif - virtual void ice_throw() const; }; -class ICE_API InvalidTimeoutException : public Exception +class ICE_API InvalidTimeoutException : public ExceptionHelper<InvalidTimeoutException> { public: InvalidTimeoutException(const char*, int, const Time&); virtual std::string ice_id() const; virtual void ice_print(std::ostream&) const; + #ifndef ICE_CPP11_MAPPING virtual InvalidTimeoutException* ice_clone() const; #endif - virtual void ice_throw() const; private: diff --git a/cpp/include/IceUtil/UniquePtr.h b/cpp/include/IceUtil/UniquePtr.h index e58f32fd608..0a81df47fad 100644 --- a/cpp/include/IceUtil/UniquePtr.h +++ b/cpp/include/IceUtil/UniquePtr.h @@ -15,11 +15,12 @@ namespace IceUtil { -// -// This is temporary and very partial placeholder for std::unique_ptr, -// which is not yet widely available. -// +#ifdef ICE_CPP11_MAPPING +template<typename T> +using UniquePtr = std::unique_ptr<T>; + +#else template<typename T> class UniquePtr @@ -84,6 +85,11 @@ public: return _ptr; } + operator bool() const + { + return _ptr != 0; + } + void swap(UniquePtr& a) { T* tmp = a._ptr; @@ -96,6 +102,8 @@ private: T* _ptr; }; +#endif + } // End of namespace IceUtil #endif diff --git a/cpp/src/Glacier2Lib/Application.cpp b/cpp/src/Glacier2Lib/Application.cpp index b9598c21ceb..c1a531c21b7 100644 --- a/cpp/src/Glacier2Lib/Application.cpp +++ b/cpp/src/Glacier2Lib/Application.cpp @@ -58,12 +58,6 @@ Glacier2::RestartSessionException::ice_clone() const } #endif -void -Glacier2::RestartSessionException::ice_throw() const -{ - throw *this; -} - Ice::ObjectAdapterPtr Glacier2::Application::objectAdapter() { diff --git a/cpp/src/Glacier2Lib/SessionHelper.cpp b/cpp/src/Glacier2Lib/SessionHelper.cpp index 6204bd89126..b5b07f57d6a 100644 --- a/cpp/src/Glacier2Lib/SessionHelper.cpp +++ b/cpp/src/Glacier2Lib/SessionHelper.cpp @@ -525,30 +525,15 @@ public: virtual void run() { -#ifdef ICE_CPP11_MAPPING - try - { - rethrow_exception(_ex); - } - catch(const Ice::Exception& ex) - { - _callback->connectFailed(_session, ex); - } -#else const Ice::Exception* ex(_ex.get()); _callback->connectFailed(_session, *ex); -#endif } private: const Glacier2::SessionCallbackPtr _callback; const Glacier2::SessionHelperPtr _session; -#ifdef ICE_CPP11_MAPPING - std::exception_ptr _ex; -#else IceUtil::UniquePtr<Ice::Exception> _ex; -#endif }; class CreatedCommunicator : public Ice::DispatcherCall diff --git a/cpp/src/Ice/BatchRequestQueue.h b/cpp/src/Ice/BatchRequestQueue.h index c7e30c6bd65..c8cb3090e7a 100644 --- a/cpp/src/Ice/BatchRequestQueue.h +++ b/cpp/src/Ice/BatchRequestQueue.h @@ -54,11 +54,7 @@ private: bool _batchStreamCanFlush; int _batchRequestNum; size_t _batchMarker; -#ifdef ICE_CPP11_MAPPING - std::exception_ptr _exception; -#else IceUtil::UniquePtr<Ice::LocalException> _exception; -#endif size_t _maxSize; }; diff --git a/cpp/src/Ice/ConnectRequestHandler.cpp b/cpp/src/Ice/ConnectRequestHandler.cpp index ee1ed2376a6..dcfd582fde3 100644 --- a/cpp/src/Ice/ConnectRequestHandler.cpp +++ b/cpp/src/Ice/ConnectRequestHandler.cpp @@ -166,11 +166,7 @@ ConnectRequestHandler::waitForConnection() Lock sync(*this); if(ICE_EXCEPTION_ISSET(_exception)) { -#ifdef ICE_CPP11_MAPPING - throw RetryException(_exception); -#else throw RetryException(*_exception.get()); -#endif } // // Wait for the connection establishment to complete or fail. @@ -332,7 +328,7 @@ ConnectRequestHandler::flushRequests() } #ifdef ICE_CPP11_MAPPING - std::exception_ptr exception; + std::unique_ptr<Ice::LocalException> exception; #else IceUtil::UniquePtr<Ice::LocalException> exception; #endif @@ -352,11 +348,8 @@ ConnectRequestHandler::flushRequests() } catch(const RetryException& ex) { -#ifdef ICE_CPP11_MAPPING - exception = ex.get(); -#else - exception.reset(ex.get()->ice_clone()); -#endif + ICE_RESET_EXCEPTION(exception, ex.get()->ice_clone()); + try { ICE_RETHROW_EXCEPTION(exception); diff --git a/cpp/src/Ice/ConnectRequestHandler.h b/cpp/src/Ice/ConnectRequestHandler.h index 771d682ac7a..222021469f1 100644 --- a/cpp/src/Ice/ConnectRequestHandler.h +++ b/cpp/src/Ice/ConnectRequestHandler.h @@ -75,11 +75,7 @@ private: Ice::ConnectionIPtr _connection; bool _compress; -#ifdef ICE_CPP11_MAPPING - std::exception_ptr _exception; -#else IceUtil::UniquePtr<Ice::LocalException> _exception; -#endif bool _initialized; bool _flushing; diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index d75a0dd2222..82e1b48d6aa 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -624,11 +624,7 @@ Ice::ConnectionI::sendRequest(OutgoingBase* out, bool compress, bool response, i // if(ICE_EXCEPTION_ISSET(_exception)) { -#ifdef ICE_CPP11_MAPPING - throw RetryException(_exception); -#else throw RetryException(*_exception.get()); -#endif } assert(_state > StateNotValidated); @@ -716,11 +712,7 @@ Ice::ConnectionI::sendAsyncRequest(const OutgoingAsyncBasePtr& out, bool compres // if(ICE_EXCEPTION_ISSET(_exception)) { -#ifdef ICE_CPP11_MAPPING - throw RetryException(_exception); -#else throw RetryException(*_exception.get()); -#endif } assert(_state > StateNotValidated); assert(_state < StateClosing); @@ -2579,11 +2571,7 @@ Ice::ConnectionI::initiateShutdown() // // Notify the the transceiver of the graceful connection closure. // -#ifdef ICE_CPP11_MAPPING - SocketOperation op = _transceiver->closing(true, _exception); -#else SocketOperation op = _transceiver->closing(true, *_exception.get()); -#endif if(op) { scheduleTimeout(op); @@ -2929,11 +2917,7 @@ Ice::ConnectionI::sendNextMessage(vector<OutgoingMessage>& callbacks) if(_state == StateClosing && _shutdownInitiated) { setState(StateClosingPending); -#ifdef ICE_CPP11_MAPPING - SocketOperation op = _transceiver->closing(true, _exception); -#else SocketOperation op = _transceiver->closing(true, *_exception.get()); -#endif if(op) { return op; @@ -3314,11 +3298,7 @@ Ice::ConnectionI::parseMessage(InputStream& stream, Int& invokeNum, Int& request // // Notify the the transceiver of the graceful connection closure. // -#ifdef ICE_CPP11_MAPPING - SocketOperation op = _transceiver->closing(false, _exception); -#else SocketOperation op = _transceiver->closing(false, *_exception.get()); -#endif if(op) { return op; diff --git a/cpp/src/Ice/ConnectionI.h b/cpp/src/Ice/ConnectionI.h index 023ac044e5b..a0a6cae89a1 100644 --- a/cpp/src/Ice/ConnectionI.h +++ b/cpp/src/Ice/ConnectionI.h @@ -368,11 +368,7 @@ private: std::map<Int, IceInternal::OutgoingAsyncBasePtr> _asyncRequests; std::map<Int, IceInternal::OutgoingAsyncBasePtr>::iterator _asyncRequestsHint; -#ifdef ICE_CPP11_MAPPING - std::exception_ptr _exception; -#else IceUtil::UniquePtr<LocalException> _exception; -#endif const size_t _messageSizeMax; IceInternal::BatchRequestQueuePtr _batchRequestQueue; diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp index d9d1f929fc1..848d7260502 100644 --- a/cpp/src/Ice/Exception.cpp +++ b/cpp/src/Ice/Exception.cpp @@ -116,7 +116,15 @@ const std::string& Ice::UserException::ice_staticId() { return __Ice__UserException_ids[0]; -}; +} + +#ifdef ICE_CPP11_MAPPING +unique_ptr<Ice::UserException> +Ice::UserException::ice_clone() const +{ + return unique_ptr<UserException>(static_cast<UserException*>(ice_cloneImpl())); +} +#endif void Ice::UserException::__write(::Ice::OutputStream* os) const @@ -153,6 +161,14 @@ Ice::LocalException::~LocalException() // Out of line to avoid weak vtable } +#ifdef ICE_CPP11_MAPPING +unique_ptr<Ice::LocalException> +Ice::LocalException::ice_clone() const +{ + return unique_ptr<LocalException>(static_cast<LocalException*>(ice_cloneImpl())); +} +#endif + namespace { @@ -181,6 +197,14 @@ Ice::SystemException::~SystemException() { } +#ifdef ICE_CPP11_MAPPING +unique_ptr<Ice::SystemException> +Ice::SystemException::ice_clone() const +{ + return unique_ptr<SystemException>(static_cast<SystemException*>(ice_cloneImpl())); +} +#endif + namespace { diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp index e768b442330..c570cd3702a 100644 --- a/cpp/src/Ice/LocatorInfo.cpp +++ b/cpp/src/Ice/LocatorInfo.cpp @@ -442,18 +442,7 @@ IceInternal::LocatorInfo::Request::addCallback(const ReferencePtr& ref, else { assert(ICE_EXCEPTION_ISSET(_exception)); -#ifdef ICE_CPP11_MAPPING - try - { - rethrow_exception(_exception); - } - catch(const Ice::Exception& ex) - { - callback->exception(_locatorInfo, ex); - } -#else callback->exception(_locatorInfo, *_exception.get()); -#endif } } @@ -486,18 +475,7 @@ IceInternal::LocatorInfo::Request::getEndpoints(const ReferencePtr& ref, if(ICE_EXCEPTION_ISSET(_exception)) { -#ifdef ICE_CPP11_MAPPING - try - { - rethrow_exception(_exception); - } - catch(const Ice::Exception& ex) - { - _locatorInfo->getEndpointsException(ref, ex); // This throws. - } -#else _locatorInfo->getEndpointsException(ref, *_exception.get()); // This throws. -#endif } assert(_response); diff --git a/cpp/src/Ice/LocatorInfo.h b/cpp/src/Ice/LocatorInfo.h index b3f445b3f22..25b116913c3 100644 --- a/cpp/src/Ice/LocatorInfo.h +++ b/cpp/src/Ice/LocatorInfo.h @@ -132,11 +132,7 @@ public: bool _sent; bool _response; Ice::ObjectPrxPtr _proxy; -#ifdef ICE_CPP11_MAPPING - std::exception_ptr _exception; -#else IceUtil::UniquePtr<Ice::Exception> _exception; -#endif }; typedef IceUtil::Handle<Request> RequestPtr; diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp index 3c1ad6bfd14..66965b23332 100644 --- a/cpp/src/Ice/Outgoing.cpp +++ b/cpp/src/Ice/Outgoing.cpp @@ -561,18 +561,7 @@ Outgoing::completed(InputStream& is) default: { -#ifdef ICE_CPP11_MAPPING - try - { - throw UnknownReplyStatusException(__FILE__, __LINE__); - } - catch(...) - { - _exception = current_exception(); - } -#else _exception.reset(new UnknownReplyStatusException(__FILE__, __LINE__)); -#endif _state = StateLocalException; break; } diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index 24691b9f755..507311ce3f8 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -1282,24 +1282,10 @@ ConnectionFlushBatchAsync::invoke(const string& operation) } catch(const RetryException& ex) { -#ifdef ICE_CPP11_MAPPING - try - { - rethrow_exception(ex.get()); - } - catch(const Ice::LocalException& ee) - { - if(exception(ee)) - { - invokeExceptionAsync(); - } - } -#else if(exception(*ex.get())) { invokeExceptionAsync(); } -#endif } catch(const Exception& ex) { diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index 772af952742..4e28f98dac7 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -1818,11 +1818,7 @@ IceInternal::RoutableReference::createConnection(const vector<EndpointIPtr>& all const vector<EndpointIPtr> _endpoints; const GetConnectionCallbackPtr _callback; size_t _i; -#ifdef ICE_CPP11_MAPPING - std::exception_ptr _exception; -#else IceUtil::UniquePtr<Ice::LocalException> _exception; -#endif }; // diff --git a/cpp/src/Ice/RequestHandler.cpp b/cpp/src/Ice/RequestHandler.cpp index bca8cbb84eb..35e67a41864 100644 --- a/cpp/src/Ice/RequestHandler.cpp +++ b/cpp/src/Ice/RequestHandler.cpp @@ -13,34 +13,20 @@ using namespace std; using namespace IceInternal; -#ifdef ICE_CPP11_MAPPING -RetryException::RetryException(std::exception_ptr ex) : _ex(ex) -{ -} - -RetryException::RetryException(const RetryException& ex) : _ex(ex.get()) -{ -} - -exception_ptr -RetryException::get() const -{ - assert(_ex); - return _ex; -} - -#else +#ifndef ICE_CPP11_MAPPING IceUtil::Shared* IceInternal::upCast(RequestHandler* p) { return p; } IceUtil::Shared* IceInternal::upCast(CancellationHandler* p) { return p; } +#endif + RetryException::RetryException(const Ice::LocalException& ex) { - _ex.reset(ex.ice_clone()); + ICE_RESET_EXCEPTION(_ex, ex.ice_clone()); } RetryException::RetryException(const RetryException& ex) { - _ex.reset(ex.get()->ice_clone()); + ICE_RESET_EXCEPTION(_ex, ex.get()->ice_clone()); } const Ice::LocalException* @@ -49,7 +35,6 @@ RetryException::get() const assert(_ex.get()); return _ex.get(); } -#endif RequestHandler::RequestHandler(const ReferencePtr& reference) : _reference(reference), diff --git a/cpp/src/Ice/RequestHandler.h b/cpp/src/Ice/RequestHandler.h index dcad80c2c35..c1ce9446f0e 100644 --- a/cpp/src/Ice/RequestHandler.h +++ b/cpp/src/Ice/RequestHandler.h @@ -36,21 +36,6 @@ class ProxyOutgoingBase; // An exception wrapper, which is used to notify that the request // handler should be cleared and the invocation retried. // -#ifdef ICE_CPP11_MAPPING -class RetryException -{ -public: - - RetryException(std::exception_ptr); - RetryException(const RetryException&); - - std::exception_ptr get() const; - -private: - - std::exception_ptr _ex; -}; -#else class RetryException { public: @@ -64,7 +49,6 @@ private: IceUtil::UniquePtr<Ice::LocalException> _ex; }; -#endif class CancellationHandler diff --git a/cpp/src/Ice/RouterInfo.h b/cpp/src/Ice/RouterInfo.h index b7f7821d13d..acd24af3476 100644 --- a/cpp/src/Ice/RouterInfo.h +++ b/cpp/src/Ice/RouterInfo.h @@ -45,7 +45,7 @@ private: #ifdef ICE_CPP11_MAPPING using RouterTableMap = std::map<std::shared_ptr<Ice::RouterPrx>, - RouterInfoPtr, + RouterInfoPtr, Ice::TargetLess<std::shared_ptr<::Ice::RouterPrx>>>; #else typedef std::map<Ice::RouterPrxPtr, RouterInfoPtr> RouterTableMap; diff --git a/cpp/src/Ice/TcpTransceiver.cpp b/cpp/src/Ice/TcpTransceiver.cpp index be280be0476..808ac140443 100644 --- a/cpp/src/Ice/TcpTransceiver.cpp +++ b/cpp/src/Ice/TcpTransceiver.cpp @@ -31,11 +31,7 @@ IceInternal::TcpTransceiver::initialize(Buffer& readBuffer, Buffer& writeBuffer) } SocketOperation -#ifdef ICE_CPP11_MAPPING -IceInternal::TcpTransceiver::closing(bool initiator, exception_ptr) -#else IceInternal::TcpTransceiver::closing(bool initiator, const Ice::LocalException&) -#endif { // If we are initiating the connection closure, wait for the peer // to close the TCP/IP connection. Otherwise, close immediately. diff --git a/cpp/src/Ice/TcpTransceiver.h b/cpp/src/Ice/TcpTransceiver.h index 198b4aeab77..dc3d279d6dc 100644 --- a/cpp/src/Ice/TcpTransceiver.h +++ b/cpp/src/Ice/TcpTransceiver.h @@ -28,11 +28,8 @@ public: virtual NativeInfoPtr getNativeInfo(); virtual SocketOperation initialize(Buffer&, Buffer&); -#ifdef ICE_CPP11_MAPPING - virtual SocketOperation closing(bool, std::exception_ptr); -#else virtual SocketOperation closing(bool, const Ice::LocalException&); -#endif + virtual void close(); virtual SocketOperation write(Buffer&); virtual SocketOperation read(Buffer&); diff --git a/cpp/src/Ice/Transceiver.h b/cpp/src/Ice/Transceiver.h index a0f14ce7ad7..f21e3a27aaf 100644 --- a/cpp/src/Ice/Transceiver.h +++ b/cpp/src/Ice/Transceiver.h @@ -28,11 +28,8 @@ public: virtual NativeInfoPtr getNativeInfo() = 0; virtual SocketOperation initialize(Buffer&, Buffer&) = 0; -#ifdef ICE_CPP11_MAPPING - virtual SocketOperation closing(bool, std::exception_ptr) = 0; -#else virtual SocketOperation closing(bool, const Ice::LocalException&) = 0; -#endif + virtual void close() = 0; virtual EndpointIPtr bind(); virtual SocketOperation write(Buffer&) = 0; diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp index 3ec0db137e2..c6a6b6352f7 100755 --- a/cpp/src/Ice/UdpTransceiver.cpp +++ b/cpp/src/Ice/UdpTransceiver.cpp @@ -97,11 +97,7 @@ IceInternal::UdpTransceiver::initialize(Buffer& /*readBuffer*/, Buffer& /*writeB } SocketOperation -#ifdef ICE_CPP11_MAPPING -IceInternal::UdpTransceiver::closing(bool, exception_ptr) -#else IceInternal::UdpTransceiver::closing(bool, const Ice::LocalException&) -#endif { // Nothing to do. return SocketOperationNone; diff --git a/cpp/src/Ice/UdpTransceiver.h b/cpp/src/Ice/UdpTransceiver.h index 84b600d68c2..fa81553eb3c 100644 --- a/cpp/src/Ice/UdpTransceiver.h +++ b/cpp/src/Ice/UdpTransceiver.h @@ -43,11 +43,7 @@ public: #endif virtual SocketOperation initialize(Buffer&, Buffer&); -#ifdef ICE_CPP11_MAPPING - virtual SocketOperation closing(bool, std::exception_ptr); -#else virtual SocketOperation closing(bool, const Ice::LocalException&); -#endif virtual void close(); virtual EndpointIPtr bind(); virtual SocketOperation write(Buffer&); diff --git a/cpp/src/Ice/WSTransceiver.cpp b/cpp/src/Ice/WSTransceiver.cpp index 24d97b89920..0c33cfe8d8f 100644 --- a/cpp/src/Ice/WSTransceiver.cpp +++ b/cpp/src/Ice/WSTransceiver.cpp @@ -410,11 +410,7 @@ IceInternal::WSTransceiver::initialize(Buffer& readBuffer, Buffer& writeBuffer) } SocketOperation -#ifdef ICE_CPP11_MAPPING -IceInternal::WSTransceiver::closing(bool initiator, exception_ptr reason) -#else IceInternal::WSTransceiver::closing(bool initiator, const Ice::LocalException& reason) -#endif { if(_instance->traceLevel() >= 1) { @@ -444,38 +440,7 @@ IceInternal::WSTransceiver::closing(bool initiator, const Ice::LocalException& r } _closingInitiator = initiator; -#ifdef ICE_CPP11_MAPPING - if(reason) - { - try - { - rethrow_exception(reason); - } - catch(const Ice::CloseConnectionException&) - { - _closingReason = CLOSURE_NORMAL; - } - catch(const Ice::ObjectAdapterDeactivatedException&) - { - _closingReason = CLOSURE_SHUTDOWN; - } - catch(Ice::CommunicatorDestroyedException&) - { - _closingReason = CLOSURE_SHUTDOWN; - } - catch(const Ice::MemoryLimitException&) - { - _closingReason = CLOSURE_TOO_BIG; - } - catch(const Ice::ProtocolException&) - { - _closingReason = CLOSURE_PROTOCOL_ERROR; - } - catch(...) - { - } - } -#else + if(dynamic_cast<const Ice::CloseConnectionException*>(&reason)) { _closingReason = CLOSURE_NORMAL; @@ -493,7 +458,6 @@ IceInternal::WSTransceiver::closing(bool initiator, const Ice::LocalException& r { _closingReason = CLOSURE_TOO_BIG; } -#endif if(_state == StateOpened) { diff --git a/cpp/src/Ice/WSTransceiver.h b/cpp/src/Ice/WSTransceiver.h index 7b6a7ffe5e6..c34a8438c7e 100644 --- a/cpp/src/Ice/WSTransceiver.h +++ b/cpp/src/Ice/WSTransceiver.h @@ -34,11 +34,7 @@ public: #endif virtual SocketOperation initialize(Buffer&, Buffer&); -#ifdef ICE_CPP11_MAPPING - virtual SocketOperation closing(bool, std::exception_ptr); -#else virtual SocketOperation closing(bool, const Ice::LocalException&); -#endif virtual void close(); virtual SocketOperation write(Buffer&); virtual SocketOperation read(Buffer&); diff --git a/cpp/src/Ice/ios/StreamTransceiver.cpp b/cpp/src/Ice/ios/StreamTransceiver.cpp index 4fcbec4f400..8c9305f4031 100644 --- a/cpp/src/Ice/ios/StreamTransceiver.cpp +++ b/cpp/src/Ice/ios/StreamTransceiver.cpp @@ -297,11 +297,7 @@ IceObjC::StreamTransceiver::initialize(Buffer& readBuffer, Buffer& writeBuffer) } SocketOperation -#ifdef ICE_CPP11_MAPPING -IceObjC::StreamTransceiver::closing(bool initiator, exception_ptr) -#else IceObjC::StreamTransceiver::closing(bool initiator, const Ice::LocalException&) -#endif { // If we are initiating the connection closure, wait for the peer // to close the TCP/IP connection. Otherwise, close immediately. diff --git a/cpp/src/Ice/ios/StreamTransceiver.h b/cpp/src/Ice/ios/StreamTransceiver.h index e38285451f8..c6ba084b64b 100644 --- a/cpp/src/Ice/ios/StreamTransceiver.h +++ b/cpp/src/Ice/ios/StreamTransceiver.h @@ -52,11 +52,7 @@ public: virtual void closeStreams(); virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&); -#ifdef ICE_CPP11_MAPPING - virtual IceInternal::SocketOperation closing(bool initiator, std::exception_ptr); -#else virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&); -#endif virtual void close(); virtual IceInternal::SocketOperation write(IceInternal::Buffer&); diff --git a/cpp/src/IceBT/TransceiverI.cpp b/cpp/src/IceBT/TransceiverI.cpp index 4a3f4005803..327c96d9ef3 100644 --- a/cpp/src/IceBT/TransceiverI.cpp +++ b/cpp/src/IceBT/TransceiverI.cpp @@ -35,11 +35,7 @@ IceBT::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal::Bu } IceInternal::SocketOperation -#ifdef ICE_CPP11_MAPPING -IceBT::TransceiverI::closing(bool initiator, exception_ptr) -#else IceBT::TransceiverI::closing(bool initiator, const Ice::LocalException&) -#endif { // // If we are initiating the connection closure, wait for the peer diff --git a/cpp/src/IceBT/TransceiverI.h b/cpp/src/IceBT/TransceiverI.h index dee886dffb3..04170a52327 100644 --- a/cpp/src/IceBT/TransceiverI.h +++ b/cpp/src/IceBT/TransceiverI.h @@ -28,11 +28,8 @@ public: virtual IceInternal::NativeInfoPtr getNativeInfo(); virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&); -#ifdef ICE_CPP11_MAPPING - virtual IceInternal::SocketOperation closing(bool, std::exception_ptr); -#else + virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&); -#endif virtual void close(); virtual IceInternal::SocketOperation write(IceInternal::Buffer&); virtual IceInternal::SocketOperation read(IceInternal::Buffer&); diff --git a/cpp/src/IceIAP/Transceiver.h b/cpp/src/IceIAP/Transceiver.h index b82ed27c395..ee625845713 100644 --- a/cpp/src/IceIAP/Transceiver.h +++ b/cpp/src/IceIAP/Transceiver.h @@ -45,11 +45,8 @@ public: virtual IceInternal::NativeInfoPtr getNativeInfo(); virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&); -#ifdef ICE_CPP11_MAPPING - virtual IceInternal::SocketOperation closing(bool, std::exception_ptr); -#else + virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&); -#endif virtual void close(); virtual IceInternal::SocketOperation write(IceInternal::Buffer&); virtual IceInternal::SocketOperation read(IceInternal::Buffer&); diff --git a/cpp/src/IceIAP/Transceiver.mm b/cpp/src/IceIAP/Transceiver.mm index 23496965421..0d7c332120d 100644 --- a/cpp/src/IceIAP/Transceiver.mm +++ b/cpp/src/IceIAP/Transceiver.mm @@ -254,11 +254,7 @@ IceObjC::iAPTransceiver::initialize(Buffer& readBuffer, Buffer& writeBuffer) } SocketOperation -#ifdef ICE_CPP11_MAPPING -IceObjC::iAPTransceiver::closing(bool initiator, exception_ptr) -#else IceObjC::iAPTransceiver::closing(bool initiator, const Ice::LocalException&) -#endif { // If we are initiating the connection closure, wait for the peer // to close the TCP/IP connection. Otherwise, close immediately. diff --git a/cpp/src/IceSSL/Certificate.cpp b/cpp/src/IceSSL/Certificate.cpp index 7fb39540760..1d1a545e7a4 100755 --- a/cpp/src/IceSSL/Certificate.cpp +++ b/cpp/src/IceSSL/Certificate.cpp @@ -597,7 +597,7 @@ certificateAltNames(Windows::Security::Cryptography::Certificates::SubjectAltern #endif CertificateReadException::CertificateReadException(const char* file, int line, const string& r) : - Exception(file, line), + ExceptionHelper<CertificateReadException>(file, line), reason(r) { } @@ -622,15 +622,9 @@ CertificateReadException::ice_clone() const } #endif -void -CertificateReadException::ice_throw() const -{ - throw *this; -} - #ifdef ICE_USE_SECURE_TRANSPORT CertificateEncodingException::CertificateEncodingException(const char* file, int line, CFErrorRef err) : - Exception(file, line) + ExceptionHelper<CertificateEncodingException>(file, line) { assert(err); reason = "certificate error:\n" + errorToString(err); @@ -639,7 +633,7 @@ CertificateEncodingException::CertificateEncodingException(const char* file, int #endif CertificateEncodingException::CertificateEncodingException(const char* file, int line, const string& r) : - Exception(file, line), + ExceptionHelper<CertificateEncodingException>(file, line), reason(r) { } @@ -664,12 +658,6 @@ CertificateEncodingException::ice_clone() const } #endif -void -CertificateEncodingException::ice_throw() const -{ - throw *this; -} - #ifdef ICE_USE_OPENSSL namespace @@ -843,7 +831,7 @@ convertGeneralNames(GENERAL_NAMES* gens) #endif ParseException::ParseException(const char* file, int line, const string& r) : - Exception(file, line), + ExceptionHelper<ParseException>(file, line), reason(r) { } @@ -868,12 +856,6 @@ ParseException::ice_clone() const } #endif -void -ParseException::ice_throw() const -{ - throw *this; -} - #ifdef ICE_USE_OPENSSL DistinguishedName::DistinguishedName(X509NAME* name) : _rdns(RFC2253::parseStrict(convertX509NameToString(name))) { diff --git a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp index de7fbb3ade6..75bc146e14f 100644 --- a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +++ b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp @@ -307,11 +307,7 @@ IceSSL::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal::B } IceInternal::SocketOperation -#ifdef ICE_CPP11_MAPPING -IceSSL::TransceiverI::closing(bool initiator, exception_ptr) -#else IceSSL::TransceiverI::closing(bool initiator, const Ice::LocalException&) -#endif { // If we are initiating the connection closure, wait for the peer // to close the TCP/IP connection. Otherwise, close immediately. diff --git a/cpp/src/IceSSL/OpenSSLTransceiverI.h b/cpp/src/IceSSL/OpenSSLTransceiverI.h index 58459e804b9..539c531355f 100644 --- a/cpp/src/IceSSL/OpenSSLTransceiverI.h +++ b/cpp/src/IceSSL/OpenSSLTransceiverI.h @@ -39,11 +39,7 @@ public: virtual IceInternal::NativeInfoPtr getNativeInfo(); virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&); -#ifdef ICE_CPP11_MAPPING - virtual IceInternal::SocketOperation closing(bool, std::exception_ptr); -#else virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&); -#endif virtual void close(); virtual IceInternal::SocketOperation write(IceInternal::Buffer&); virtual IceInternal::SocketOperation read(IceInternal::Buffer&); diff --git a/cpp/src/IceSSL/SChannelTransceiverI.cpp b/cpp/src/IceSSL/SChannelTransceiverI.cpp index 87505808cd3..9409467e0ab 100644 --- a/cpp/src/IceSSL/SChannelTransceiverI.cpp +++ b/cpp/src/IceSSL/SChannelTransceiverI.cpp @@ -756,11 +756,7 @@ IceSSL::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal::B } IceInternal::SocketOperation -#ifdef ICE_CPP11_MAPPING -IceSSL::TransceiverI::closing(bool initiator, exception_ptr) -#else IceSSL::TransceiverI::closing(bool initiator, const Ice::LocalException&) -#endif { // If we are initiating the connection closure, wait for the peer // to close the TCP/IP connection. Otherwise, close immediately. diff --git a/cpp/src/IceSSL/SChannelTransceiverI.h b/cpp/src/IceSSL/SChannelTransceiverI.h index dc9d8030b61..c70ade9a7e5 100644 --- a/cpp/src/IceSSL/SChannelTransceiverI.h +++ b/cpp/src/IceSSL/SChannelTransceiverI.h @@ -50,11 +50,7 @@ public: virtual IceInternal::NativeInfoPtr getNativeInfo(); virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&); -#ifdef ICE_CPP11_MAPPING - virtual IceInternal::SocketOperation closing(bool, std::exception_ptr); -#else virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&); -#endif virtual void close(); virtual IceInternal::SocketOperation write(IceInternal::Buffer&); virtual IceInternal::SocketOperation read(IceInternal::Buffer&); diff --git a/cpp/src/IceSSL/SecureTransportEngine.cpp b/cpp/src/IceSSL/SecureTransportEngine.cpp index 1876477794c..6dd7e82b233 100644 --- a/cpp/src/IceSSL/SecureTransportEngine.cpp +++ b/cpp/src/IceSSL/SecureTransportEngine.cpp @@ -11,6 +11,7 @@ #include <IceUtil/FileUtil.h> #include <IceUtil/StringUtil.h> +#include <IceUtil/MutexPtrLock.h> #include <Ice/LocalException.h> #include <Ice/Properties.h> diff --git a/cpp/src/IceSSL/SecureTransportTransceiverI.cpp b/cpp/src/IceSSL/SecureTransportTransceiverI.cpp index f407e008913..9471070bfea 100644 --- a/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +++ b/cpp/src/IceSSL/SecureTransportTransceiverI.cpp @@ -318,11 +318,7 @@ IceSSL::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal::B } IceInternal::SocketOperation -#ifdef ICE_CPP11_MAPPING -IceSSL::TransceiverI::closing(bool initiator, exception_ptr) -#else IceSSL::TransceiverI::closing(bool initiator, const Ice::LocalException&) -#endif { // If we are initiating the connection closure, wait for the peer // to close the TCP/IP connection. Otherwise, close immediately. diff --git a/cpp/src/IceSSL/SecureTransportTransceiverI.h b/cpp/src/IceSSL/SecureTransportTransceiverI.h index 71a2a6c5f34..59ac94b8584 100644 --- a/cpp/src/IceSSL/SecureTransportTransceiverI.h +++ b/cpp/src/IceSSL/SecureTransportTransceiverI.h @@ -37,11 +37,7 @@ public: virtual IceInternal::NativeInfoPtr getNativeInfo(); virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&); -#ifdef ICE_CPP11_MAPPING - virtual IceInternal::SocketOperation closing(bool, std::exception_ptr); -#else virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&); -#endif virtual void close(); virtual IceInternal::SocketOperation write(IceInternal::Buffer&); virtual IceInternal::SocketOperation read(IceInternal::Buffer&); diff --git a/cpp/src/IceSSL/WinRTTransceiverI.cpp b/cpp/src/IceSSL/WinRTTransceiverI.cpp index 5c7058a3d31..d9bca2912a9 100755 --- a/cpp/src/IceSSL/WinRTTransceiverI.cpp +++ b/cpp/src/IceSSL/WinRTTransceiverI.cpp @@ -55,11 +55,7 @@ IceSSL::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal::B } IceInternal::SocketOperation -#ifdef ICE_CPP11_MAPPING -IceSSL::TransceiverI::closing(bool initiator, exception_ptr ex) -#else IceSSL::TransceiverI::closing(bool initiator, const Ice::LocalException& ex) -#endif { return _delegate->closing(initiator, ex); } diff --git a/cpp/src/IceSSL/WinRTTransceiverI.h b/cpp/src/IceSSL/WinRTTransceiverI.h index d3994eb359a..29d285175a6 100755 --- a/cpp/src/IceSSL/WinRTTransceiverI.h +++ b/cpp/src/IceSSL/WinRTTransceiverI.h @@ -34,11 +34,7 @@ public: virtual IceInternal::NativeInfoPtr getNativeInfo(); virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&); -#ifdef ICE_CPP11_MAPPING - virtual IceInternal::SocketOperation closing(bool, std::exception_ptr); -#else virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&); -#endif virtual void close(); virtual IceInternal::SocketOperation write(IceInternal::Buffer&); virtual IceInternal::SocketOperation read(IceInternal::Buffer&); diff --git a/cpp/src/IceSSL/uwp/TransceiverI.cpp b/cpp/src/IceSSL/uwp/TransceiverI.cpp index 06ef9f8a6e1..0ec28120a7f 100644 --- a/cpp/src/IceSSL/uwp/TransceiverI.cpp +++ b/cpp/src/IceSSL/uwp/TransceiverI.cpp @@ -88,11 +88,7 @@ IceSSL::TransceiverI::initialize(IceInternal::Buffer&, IceInternal::Buffer&) } IceInternal::SocketOperation -#ifdef ICE_CPP11_MAPPING -IceSSL::TransceiverI::closing(bool initiator, exception_ptr) -#else IceSSL::TransceiverI::closing(bool initiator, const Ice::LocalException&) -#endif { // If we are initiating the connection closure, wait for the peer // to close the TCP/IP connection. Otherwise, close immediately. diff --git a/cpp/src/IceSSL/uwp/TransceiverI.h b/cpp/src/IceSSL/uwp/TransceiverI.h index ef7a51fb7af..4e8b7e6c620 100644 --- a/cpp/src/IceSSL/uwp/TransceiverI.h +++ b/cpp/src/IceSSL/uwp/TransceiverI.h @@ -38,11 +38,8 @@ public: virtual void setCompletedHandler(IceInternal::SocketOperationCompletedHandler^); virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&); -#ifdef ICE_CPP11_MAPPING - virtual IceInternal::SocketOperation closing(bool, std::exception_ptr); -#else + virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&); -#endif virtual void close(); virtual IceInternal::SocketOperation write(IceInternal::Buffer&); virtual IceInternal::SocketOperation read(IceInternal::Buffer&); diff --git a/cpp/src/IceUtil/CtrlCHandler.cpp b/cpp/src/IceUtil/CtrlCHandler.cpp index 6eac2e7e05a..4fd8fe406fd 100644 --- a/cpp/src/IceUtil/CtrlCHandler.cpp +++ b/cpp/src/IceUtil/CtrlCHandler.cpp @@ -51,7 +51,7 @@ Init init; } CtrlCHandlerException::CtrlCHandlerException(const char* file, int line) : - Exception(file, line) + ExceptionHelper<CtrlCHandlerException>(file, line) { } @@ -70,19 +70,13 @@ CtrlCHandlerException::ice_clone() const #endif void -CtrlCHandlerException::ice_throw() const -{ - throw *this; -} - -void CtrlCHandler::setCallback(CtrlCHandlerCallback callback) { IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(globalMutex); _callback = callback; } -CtrlCHandlerCallback +CtrlCHandlerCallback CtrlCHandler::getCallback() const { IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(globalMutex); @@ -140,10 +134,10 @@ CtrlCHandler::~CtrlCHandler() #else -extern "C" +extern "C" { -static void* +static void* sigwaitThread(void*) { sigset_t ctrlCLikeSignals; @@ -168,7 +162,7 @@ sigwaitThread(void*) continue; } assert(rc == 0); - + CtrlCHandlerCallback callback; { IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(globalMutex); @@ -211,11 +205,11 @@ CtrlCHandler::CtrlCHandler(CtrlCHandlerCallback callback) _handler = this; lock.release(); - + // We block these CTRL+C like signals in the main thread, // and by default all other threads will inherit this signal // mask. - + sigset_t ctrlCLikeSignals; sigemptyset(&ctrlCLikeSignals); sigaddset(&ctrlCLikeSignals, SIGHUP); @@ -265,4 +259,3 @@ CtrlCHandler::~CtrlCHandler() } #endif - diff --git a/cpp/src/IceUtil/Options.cpp b/cpp/src/IceUtil/Options.cpp index 55615665a11..88626de2d9a 100644 --- a/cpp/src/IceUtil/Options.cpp +++ b/cpp/src/IceUtil/Options.cpp @@ -16,7 +16,7 @@ using namespace std; using namespace IceUtil; IceUtilInternal::APIException::APIException(const char* file, int line, const string& r) - : IceUtil::Exception(file, line), reason(r) + : IceUtil::ExceptionHelper<APIException>(file, line), reason(r) { } @@ -50,12 +50,6 @@ IceUtilInternal::APIException::ice_clone() const } #endif -void -IceUtilInternal::APIException::ice_throw() const -{ - throw *this; -} - ostream& IceUtilInternal::operator<<(ostream& out, const IceUtilInternal::APIException& ex) { @@ -64,7 +58,7 @@ IceUtilInternal::operator<<(ostream& out, const IceUtilInternal::APIException& e } IceUtilInternal::BadOptException::BadOptException(const char* file, int line, const string& r) - : IceUtil::Exception(file, line), reason(r) + : IceUtil::ExceptionHelper<BadOptException>(file, line), reason(r) { } @@ -98,12 +92,6 @@ IceUtilInternal::BadOptException::ice_clone() const } #endif -void -IceUtilInternal::BadOptException::ice_throw() const -{ - throw *this; -} - ostream& IceUtilInternal::operator<<(ostream& out, const IceUtilInternal::BadOptException& ex) { diff --git a/cpp/src/IceUtil/ThreadException.cpp b/cpp/src/IceUtil/ThreadException.cpp index c41106820ce..ec75cc19bb5 100644 --- a/cpp/src/IceUtil/ThreadException.cpp +++ b/cpp/src/IceUtil/ThreadException.cpp @@ -11,8 +11,8 @@ using namespace std; -IceUtil::ThreadSyscallException::ThreadSyscallException(const char* file, int line, int err ): - SyscallException(file, line, err) +IceUtil::ThreadSyscallException::ThreadSyscallException(const char* file, int line, int err ): + SyscallExceptionHelper<ThreadSyscallException>(file, line, err) { } @@ -30,14 +30,8 @@ IceUtil::ThreadSyscallException::ice_clone() const } #endif -void -IceUtil::ThreadSyscallException::ice_throw() const -{ - throw *this; -} - IceUtil::ThreadLockedException::ThreadLockedException(const char* file, int line) : - Exception(file, line) + ExceptionHelper<ThreadLockedException>(file, line) { } @@ -55,14 +49,9 @@ IceUtil::ThreadLockedException::ice_clone() const } #endif -void -IceUtil::ThreadLockedException::ice_throw() const -{ - throw *this; -} IceUtil::ThreadStartedException::ThreadStartedException(const char* file, int line) : - Exception(file, line) + ExceptionHelper<ThreadStartedException>(file, line) { } @@ -80,14 +69,8 @@ IceUtil::ThreadStartedException::ice_clone() const } #endif -void -IceUtil::ThreadStartedException::ice_throw() const -{ - throw *this; -} - IceUtil::ThreadNotStartedException::ThreadNotStartedException(const char* file, int line) : - Exception(file, line) + ExceptionHelper<ThreadNotStartedException>(file, line) { } @@ -97,6 +80,7 @@ IceUtil::ThreadNotStartedException::ice_id() const return "::IceUtil::ThreadNotStartedException"; } + #ifndef ICE_CPP11_MAPPING IceUtil::ThreadNotStartedException* IceUtil::ThreadNotStartedException::ice_clone() const @@ -105,15 +89,9 @@ IceUtil::ThreadNotStartedException::ice_clone() const } #endif -void -IceUtil::ThreadNotStartedException::ice_throw() const -{ - throw *this; -} - IceUtil::BadThreadControlException::BadThreadControlException(const char* file, int line) : - Exception(file, line) + ExceptionHelper<BadThreadControlException>(file, line) { } @@ -131,15 +109,9 @@ IceUtil::BadThreadControlException::ice_clone() const } #endif -void -IceUtil::BadThreadControlException::ice_throw() const -{ - throw *this; -} - -IceUtil::InvalidTimeoutException::InvalidTimeoutException(const char* file, int line, - const IceUtil::Time& timeout) : - Exception(file, line), +IceUtil::InvalidTimeoutException::InvalidTimeoutException(const char* file, int line, + const IceUtil::Time& timeout) : + ExceptionHelper<InvalidTimeoutException>(file, line), _timeout(timeout) { } @@ -150,13 +122,6 @@ IceUtil::InvalidTimeoutException::ice_id() const return "::IceUtil::InvalidTimeoutException"; } -void -IceUtil::InvalidTimeoutException::ice_print(ostream& os) const -{ - Exception::ice_print(os); - os << ":\ninvalid timeout: " << _timeout << " seconds"; -} - #ifndef ICE_CPP11_MAPPING IceUtil::InvalidTimeoutException* IceUtil::InvalidTimeoutException::ice_clone() const @@ -166,7 +131,8 @@ IceUtil::InvalidTimeoutException::ice_clone() const #endif void -IceUtil::InvalidTimeoutException::ice_throw() const +IceUtil::InvalidTimeoutException::ice_print(ostream& os) const { - throw *this; + Exception::ice_print(os); + os << ":\ninvalid timeout: " << _timeout << " seconds"; } diff --git a/cpp/src/IceUtil/UtilException.cpp b/cpp/src/IceUtil/UtilException.cpp index 734ae013e9d..50b5b7ce0f6 100644 --- a/cpp/src/IceUtil/UtilException.cpp +++ b/cpp/src/IceUtil/UtilException.cpp @@ -616,23 +616,7 @@ IceUtil::Exception::what() const ICE_NOEXCEPT return ""; } -#ifdef ICE_CPP11_MAPPING -exception_ptr -IceUtil::Exception::ice_clone() const -{ - try - { - ice_throw(); - } - catch(...) - { - return current_exception(); - } - assert(false); - return nullptr; // Make compilers happy -} -#else - +#ifndef ICE_CPP11_MAPPING string IceUtil::Exception::ice_name() const { @@ -658,6 +642,14 @@ IceUtil::Exception::ice_stackTrace() const return getStackTrace(_stackFrames); } +#ifdef ICE_CPP11_MAPPING +unique_ptr<IceUtil::Exception> +IceUtil::Exception::ice_clone() const +{ + return unique_ptr<Exception>(ice_cloneImpl()); +} +#endif + ostream& IceUtil::operator<<(ostream& out, const IceUtil::Exception& ex) { @@ -666,7 +658,7 @@ IceUtil::operator<<(ostream& out, const IceUtil::Exception& ex) } IceUtil::NullHandleException::NullHandleException(const char* file, int line) : - Exception(file, line) + ExceptionHelper<NullHandleException>(file, line) { if(IceUtilInternal::nullHandleAbort) { @@ -674,12 +666,6 @@ IceUtil::NullHandleException::NullHandleException(const char* file, int line) : } } -#ifndef ICE_CPP11_COMPILER -IceUtil::NullHandleException::~NullHandleException() throw() -{ -} -#endif - string IceUtil::NullHandleException::ice_id() const { @@ -694,19 +680,14 @@ IceUtil::NullHandleException::ice_clone() const } #endif -void -IceUtil::NullHandleException::ice_throw() const -{ - throw *this; -} IceUtil::IllegalArgumentException::IllegalArgumentException(const char* file, int line) : - Exception(file, line) + ExceptionHelper<IllegalArgumentException>(file, line) { } IceUtil::IllegalArgumentException::IllegalArgumentException(const char* file, int line, const string& r) : - Exception(file, line), + ExceptionHelper<IllegalArgumentException>(file, line), _reason(r) { } @@ -738,12 +719,6 @@ IceUtil::IllegalArgumentException::ice_clone() const } #endif -void -IceUtil::IllegalArgumentException::ice_throw() const -{ - throw *this; -} - string IceUtil::IllegalArgumentException::reason() const { @@ -754,14 +729,16 @@ IceUtil::IllegalArgumentException::reason() const // IllegalConversionException // IceUtil::IllegalConversionException::IllegalConversionException(const char* file, int line): - Exception(file, line) -{} + ExceptionHelper<IllegalConversionException>(file, line) +{ +} IceUtil::IllegalConversionException::IllegalConversionException(const char* file, int line, const string& reason): - Exception(file, line), + ExceptionHelper<IllegalConversionException>(file, line), _reason(reason) -{} +{ +} #ifndef ICE_CPP11_COMPILER IceUtil::IllegalConversionException::~IllegalConversionException() throw() @@ -791,12 +768,6 @@ IceUtil::IllegalConversionException::ice_clone() const } #endif -void -IceUtil::IllegalConversionException::ice_throw() const -{ - throw *this; -} - string IceUtil::IllegalConversionException::reason() const { @@ -806,11 +777,17 @@ IceUtil::IllegalConversionException::reason() const IceUtil::SyscallException::SyscallException(const char* file, int line, int err ): - Exception(file, line), + ExceptionHelper<SyscallException>(file, line), _error(err) { } +#ifndef ICE_CPP11_COMPILER +IceUtil::SyscallException::~SyscallException() throw() +{ +} +#endif + void IceUtil::SyscallException::ice_print(ostream& os) const { @@ -835,12 +812,6 @@ IceUtil::SyscallException::ice_clone() const } #endif -void -IceUtil::SyscallException::ice_throw() const -{ - throw *this; -} - int IceUtil::SyscallException::error() const { @@ -849,7 +820,7 @@ IceUtil::SyscallException::error() const IceUtil::FileLockException::FileLockException(const char* file, int line, int err, const string& path): - Exception(file, line), + ExceptionHelper<FileLockException>(file, line), _error(err), _path(path) { @@ -886,12 +857,6 @@ IceUtil::FileLockException::ice_clone() const } #endif -void -IceUtil::FileLockException::ice_throw() const -{ - throw *this; -} - int IceUtil::FileLockException::error() const { @@ -899,7 +864,7 @@ IceUtil::FileLockException::error() const } IceUtil::OptionalNotSetException::OptionalNotSetException(const char* file, int line) : - Exception(file, line) + ExceptionHelper<OptionalNotSetException>(file, line) { if(IceUtilInternal::nullHandleAbort) { @@ -907,12 +872,6 @@ IceUtil::OptionalNotSetException::OptionalNotSetException(const char* file, int } } -#ifndef ICE_CPP11_COMPILER -IceUtil::OptionalNotSetException::~OptionalNotSetException() throw() -{ -} -#endif - string IceUtil::OptionalNotSetException::ice_id() const { @@ -927,15 +886,9 @@ IceUtil::OptionalNotSetException::ice_clone() const } #endif -void -IceUtil::OptionalNotSetException::ice_throw() const -{ - throw *this; -} - #ifndef _WIN32 IceUtil::IconvInitializationException::IconvInitializationException(const char* file, int line, const string& reason) : - Exception(file, line), + ExceptionHelper<IconvInitializationException>(file, line), _reason(reason) { } @@ -967,12 +920,6 @@ IceUtil::IconvInitializationException::ice_clone() const } #endif -void -IceUtil::IconvInitializationException::ice_throw() const -{ - throw *this; -} - string IceUtil::IconvInitializationException::reason() const { diff --git a/cpp/src/IceXML/Parser.cpp b/cpp/src/IceXML/Parser.cpp index c10b6061557..180545bea67 100644 --- a/cpp/src/IceXML/Parser.cpp +++ b/cpp/src/IceXML/Parser.cpp @@ -20,12 +20,12 @@ using namespace IceXML; // ParserException // IceXML::ParserException::ParserException(const string& reason) : - IceUtil::Exception(), _reason(reason) + _reason(reason) { } IceXML::ParserException::ParserException(const char* file, int line, const string& reason) : - IceUtil::Exception(file, line), _reason(reason) + IceUtil::ExceptionHelper<ParserException>(file, line), _reason(reason) { } @@ -63,12 +63,6 @@ IceXML::ParserException::ice_clone() const } #endif -void -IceXML::ParserException::ice_throw() const -{ - throw *this; -} - string IceXML::ParserException::reason() const { diff --git a/cpp/src/IceXML/Parser.h b/cpp/src/IceXML/Parser.h index b44b3cac897..d6c7c43331d 100644 --- a/cpp/src/IceXML/Parser.h +++ b/cpp/src/IceXML/Parser.h @@ -42,7 +42,7 @@ namespace IceXML { -class ICE_XML_API ParserException : public IceUtil::Exception +class ICE_XML_API ParserException : public IceUtil::ExceptionHelper<ParserException> { public: @@ -57,7 +57,6 @@ public: #ifndef ICE_CPP11_MAPPING virtual ParserException* ice_clone() const; #endif - virtual void ice_throw() const; std::string reason() const; diff --git a/cpp/test/Ice/background/Transceiver.cpp b/cpp/test/Ice/background/Transceiver.cpp index 50920d04b14..18396d6e00f 100644 --- a/cpp/test/Ice/background/Transceiver.cpp +++ b/cpp/test/Ice/background/Transceiver.cpp @@ -59,11 +59,7 @@ Transceiver::initialize(IceInternal::Buffer& readBuffer, IceInternal::Buffer& wr } IceInternal::SocketOperation -#ifdef ICE_CPP11_MAPPING -Transceiver::closing(bool initiator, exception_ptr ex) -#else Transceiver::closing(bool initiator, const Ice::LocalException& ex) -#endif { return _transceiver->closing(initiator, ex); } diff --git a/cpp/test/Ice/background/Transceiver.h b/cpp/test/Ice/background/Transceiver.h index 7d9f4b80bd7..f84f531126b 100644 --- a/cpp/test/Ice/background/Transceiver.h +++ b/cpp/test/Ice/background/Transceiver.h @@ -20,11 +20,7 @@ public: virtual IceInternal::NativeInfoPtr getNativeInfo(); -#ifdef ICE_CPP11_MAPPING - virtual IceInternal::SocketOperation closing(bool, std::exception_ptr); -#else virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&); -#endif virtual void close(); virtual IceInternal::SocketOperation write(IceInternal::Buffer&); virtual IceInternal::SocketOperation read(IceInternal::Buffer&); diff --git a/cpp/test/Ice/dispatcher/Client.cpp b/cpp/test/Ice/dispatcher/Client.cpp index b94e3199616..6440ce065f3 100644 --- a/cpp/test/Ice/dispatcher/Client.cpp +++ b/cpp/test/Ice/dispatcher/Client.cpp @@ -24,27 +24,6 @@ run(int, char**, const Ice::CommunicatorPtr& communicator) return EXIT_SUCCESS; } -#ifdef ICE_CPP11_MAPPING -class DispatcherCall : public Ice::DispatcherCall -{ -public: - - DispatcherCall(function<void()> call) : - _call(move(call)) - { - } - - virtual void run() - { - _call(); - } - -private: - - function<void()> _call; -}; -#endif - int main(int argc, char* argv[]) { @@ -64,10 +43,10 @@ main(int argc, char* argv[]) initData.properties->setProperty("Ice.TCP.SndSize", "50000"); #ifdef ICE_CPP11_MAPPING - Ice::DispatcherPtr dispatcher = new Dispatcher(); + IceUtil::Handle<Dispatcher> dispatcher = new Dispatcher; initData.dispatcher = [=](function<void()> call, const shared_ptr<Ice::Connection>& conn) { - dispatcher->dispatch(new DispatcherCall(call), conn); + dispatcher->dispatch(make_shared<DispatcherCall>(call), conn); }; #else initData.dispatcher = new Dispatcher(); diff --git a/cpp/test/Ice/dispatcher/Collocated.cpp b/cpp/test/Ice/dispatcher/Collocated.cpp index a83ee20a446..b08e2440643 100644 --- a/cpp/test/Ice/dispatcher/Collocated.cpp +++ b/cpp/test/Ice/dispatcher/Collocated.cpp @@ -39,27 +39,6 @@ run(int, char**, const Ice::CommunicatorPtr& communicator) return EXIT_SUCCESS; } -#ifdef ICE_CPP11_MAPPING -class DispatcherCall : public Ice::DispatcherCall -{ -public: - - DispatcherCall(function<void()> call) : - _call(move(call)) - { - } - - virtual void run() - { - _call(); - } - -private: - - function<void()> _call; -}; -#endif - int main(int argc, char* argv[]) { @@ -72,10 +51,10 @@ main(int argc, char* argv[]) Ice::InitializationData initData; initData.properties = Ice::createProperties(argc, argv); #ifdef ICE_CPP11_MAPPING - Ice::DispatcherPtr dispatcher = new Dispatcher(); + IceUtil::Handle<Dispatcher> dispatcher = new Dispatcher; initData.dispatcher = [=](function<void()> call, const shared_ptr<Ice::Connection>& conn) { - dispatcher->dispatch(new DispatcherCall(call), conn); + dispatcher->dispatch(make_shared<DispatcherCall>(call), conn); }; #else initData.dispatcher = new Dispatcher(); diff --git a/cpp/test/Ice/dispatcher/Dispatcher.cpp b/cpp/test/Ice/dispatcher/Dispatcher.cpp index bbf991b0f65..8fb96f06e1b 100644 --- a/cpp/test/Ice/dispatcher/Dispatcher.cpp +++ b/cpp/test/Ice/dispatcher/Dispatcher.cpp @@ -42,9 +42,13 @@ Dispatcher::isDispatcherThread() return IceUtil::ThreadControl() == _instance->getThreadControl(); } +#ifdef ICE_CPP11_MAPPING +void +Dispatcher::dispatch(const shared_ptr<DispatcherCall>& call, const shared_ptr<Ice::Connection>&) +#else void Dispatcher::dispatch(const Ice::DispatcherCallPtr& call, const Ice::ConnectionPtr&) - +#endif { Lock sync(*this); _calls.push_back(call); @@ -59,7 +63,11 @@ Dispatcher::run() { while(true) { +#ifdef ICE_CPP11_MAPPING + shared_ptr<DispatcherCall> call; +#else Ice::DispatcherCallPtr call; +#endif { Lock sync(*this); @@ -95,3 +103,4 @@ Dispatcher::run() } } } + diff --git a/cpp/test/Ice/dispatcher/Dispatcher.h b/cpp/test/Ice/dispatcher/Dispatcher.h index 40236236356..b61b64f1dc3 100644 --- a/cpp/test/Ice/dispatcher/Dispatcher.h +++ b/cpp/test/Ice/dispatcher/Dispatcher.h @@ -14,17 +14,48 @@ #include <IceUtil/Monitor.h> #include <IceUtil/Mutex.h> #include <Ice/Dispatcher.h> +#include <Ice/Connection.h> #include <deque> -class Dispatcher : public Ice::Dispatcher, IceUtil::Thread, IceUtil::Monitor<IceUtil::Mutex> +#ifdef ICE_CPP11_MAPPING +class DispatcherCall +{ +public: + + DispatcherCall(std::function<void()> call) : + _call(std::move(call)) + { + } + + void run() + { + _call(); + } + +private: + + std::function<void()> _call; +}; +#endif + +class Dispatcher : +#ifndef ICE_CPP11_MAPPING + public Ice::Dispatcher, +#endif +public IceUtil::Thread, public IceUtil::Monitor<IceUtil::Mutex> { public: Dispatcher(); + +#ifdef ICE_CPP11_MAPPING + void dispatch(const std::shared_ptr<DispatcherCall>&, const std::shared_ptr<Ice::Connection>&); +#else virtual void dispatch(const Ice::DispatcherCallPtr&, const Ice::ConnectionPtr&); +#endif + - void run(); static void terminate(); static bool isDispatcherThread(); @@ -32,7 +63,11 @@ public: private: static Dispatcher* _instance; +#ifdef ICE_CPP11_MAPPING + std::deque<std::shared_ptr<DispatcherCall>> _calls; +#else std::deque<Ice::DispatcherCallPtr> _calls; +#endif bool _terminated; }; diff --git a/cpp/test/Ice/dispatcher/Server.cpp b/cpp/test/Ice/dispatcher/Server.cpp index 585bce0c16c..bdc490dd4eb 100644 --- a/cpp/test/Ice/dispatcher/Server.cpp +++ b/cpp/test/Ice/dispatcher/Server.cpp @@ -40,27 +40,6 @@ run(int, char**, const Ice::CommunicatorPtr& communicator) return EXIT_SUCCESS; } -#ifdef ICE_CPP11_MAPPING -class DispatcherCall : public Ice::DispatcherCall -{ -public: - - DispatcherCall(function<void()> call) : - _call(move(call)) - { - } - - virtual void run() - { - _call(); - } - -private: - - function<void()> _call; -}; -#endif - int main(int argc, char* argv[]) { @@ -80,10 +59,10 @@ main(int argc, char* argv[]) initData.properties->setProperty("Ice.TCP.RcvSize", "50000"); #ifdef ICE_CPP11_MAPPING - Ice::DispatcherPtr dispatcher = new Dispatcher(); + IceUtil::Handle<Dispatcher> dispatcher = new Dispatcher; initData.dispatcher = [=](function<void()> call, const shared_ptr<Ice::Connection>& conn) { - dispatcher->dispatch(new DispatcherCall(call), conn); + dispatcher->dispatch(make_shared<DispatcherCall>(call), conn); }; #else initData.dispatcher = new Dispatcher(); diff --git a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp index bcfa1a518fd..9ae2a3a83d3 100644 --- a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp +++ b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp @@ -95,21 +95,12 @@ AMDInterceptorI::getActualStatus() const return _actualStatus; } -#ifdef ICE_CPP11_MAPPING -exception_ptr -AMDInterceptorI::getException() const -{ - IceUtil::Mutex::Lock lock(_mutex); - return _exception; -} -#else IceUtil::Exception* AMDInterceptorI::getException() const { IceUtil::Mutex::Lock lock(_mutex); return _exception.get(); } -#endif void AMDInterceptorI::clear() diff --git a/cpp/test/Ice/interceptor/AMDInterceptorI.h b/cpp/test/Ice/interceptor/AMDInterceptorI.h index 50f58356142..935b179b0ba 100644 --- a/cpp/test/Ice/interceptor/AMDInterceptorI.h +++ b/cpp/test/Ice/interceptor/AMDInterceptorI.h @@ -24,11 +24,7 @@ public: virtual void clear(); Ice::DispatchStatus getActualStatus() const; -#ifdef ICE_CPP11_MAPPING - std::exception_ptr getException() const; -#else IceUtil::Exception* getException() const; -#endif void setActualStatus(Ice::DispatchStatus); void setActualStatus(const IceUtil::Exception&); @@ -37,11 +33,7 @@ private: Ice::DispatchInterceptorAsyncCallbackPtr _defaultCb; Ice::DispatchStatus _actualStatus; -#ifdef ICE_CPP11_MAPPING - std::exception_ptr _exception; -#else IceUtil::UniquePtr<IceUtil::Exception> _exception; -#endif IceUtil::Mutex _mutex; }; diff --git a/cpp/test/Ice/interceptor/Client.cpp b/cpp/test/Ice/interceptor/Client.cpp index e2bc99e9ec9..c49abdf807e 100644 --- a/cpp/test/Ice/interceptor/Client.cpp +++ b/cpp/test/Ice/interceptor/Client.cpp @@ -319,22 +319,8 @@ Client::runAmd(const Test::MyObjectPrxPtr& prx, const AMDInterceptorIPtr& interc test(interceptor->getLastStatus() == Ice::DispatchAsync); test(interceptor->getActualStatus() == Ice::DispatchAsync); -#ifdef ICE_CPP11_MAPPING - try - { - rethrow_exception(interceptor->getException()); - test(false); - } - catch(const Ice::ObjectNotExistException&) - { - } - catch(...) - { - test(false); - } -#else test(dynamic_cast<Ice::ObjectNotExistException*>(interceptor->getException()) != 0); -#endif + cout << "ok" << endl; cout << "testing system exception... " << flush; interceptor->clear(); @@ -354,22 +340,7 @@ Client::runAmd(const Test::MyObjectPrxPtr& prx, const AMDInterceptorIPtr& interc test(interceptor->getLastOperation() == "amdBadSystemAdd"); test(interceptor->getLastStatus() == Ice::DispatchAsync); test(interceptor->getActualStatus() == Ice::DispatchAsync); -#ifdef ICE_CPP11_MAPPING - try - { - rethrow_exception(interceptor->getException()); - test(false); - } - catch(const MySystemException&) - { - } - catch(...) - { - test(false); - } -#else test(dynamic_cast<MySystemException*>(interceptor->getException()) != 0); -#endif cout << "ok" << endl; return EXIT_SUCCESS; } diff --git a/cpp/test/Ice/interceptor/MyObjectI.cpp b/cpp/test/Ice/interceptor/MyObjectI.cpp index c59fb3c150d..4e9c7c1f524 100644 --- a/cpp/test/Ice/interceptor/MyObjectI.cpp +++ b/cpp/test/Ice/interceptor/MyObjectI.cpp @@ -20,19 +20,19 @@ MySystemException::MySystemException(const char* file, int line) : { } -#ifndef ICE_CPP11_COMPILER -MySystemException::~MySystemException() throw() -{ -} -#endif - string MySystemException::ice_id() const { return "::MySystemException"; } -#ifndef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_MAPPING +IceUtil::Exception* +MySystemException::ice_cloneImpl() const +{ + return new MySystemException(*this); +} +#else MySystemException* MySystemException::ice_clone() const { diff --git a/cpp/test/Ice/interceptor/MyObjectI.h b/cpp/test/Ice/interceptor/MyObjectI.h index dadd3cddebf..d75af0fce3b 100644 --- a/cpp/test/Ice/interceptor/MyObjectI.h +++ b/cpp/test/Ice/interceptor/MyObjectI.h @@ -18,15 +18,19 @@ public: MySystemException(const char*, int); -#ifndef ICE_CPP11_COMPILER - virtual ~MySystemException() throw(); -#endif - virtual std::string ice_id() const; + #ifndef ICE_CPP11_MAPPING virtual MySystemException* ice_clone() const; #endif virtual void ice_throw() const; + +#ifdef ICE_CPP11_MAPPING + +protected: + + virtual IceUtil::Exception* ice_cloneImpl() const; +#endif }; class MyObjectI : public Test::MyObject diff --git a/cpp/test/Ice/operations/OnewaysAMI.cpp b/cpp/test/Ice/operations/OnewaysAMI.cpp index 4d322b4eef4..aee37aa8ee4 100644 --- a/cpp/test/Ice/operations/OnewaysAMI.cpp +++ b/cpp/test/Ice/operations/OnewaysAMI.cpp @@ -16,7 +16,10 @@ using namespace std; namespace { -class CallbackBase : public Ice::LocalObject +class CallbackBase +#ifndef ICE_CPP11_MAPPING +: public Ice::LocalObject +#endif { public: @@ -55,8 +58,6 @@ private: bool _called; }; -typedef IceUtil::Handle<CallbackBase> CallbackBasePtr; - class Callback : public CallbackBase { public: @@ -75,7 +76,7 @@ public: test(false); } }; -typedef IceUtil::Handle<Callback> CallbackPtr; +ICE_DEFINE_PTR(CallbackPtr, Callback); } @@ -85,7 +86,7 @@ onewaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy) Test::MyClassPrxPtr p = ICE_UNCHECKED_CAST(Test::MyClassPrx, proxy->ice_oneway()); { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->ice_pingAsync( nullptr, @@ -162,7 +163,7 @@ onewaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy) } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opVoidAsync( nullptr, @@ -183,7 +184,7 @@ onewaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy) } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opIdempotentAsync( nullptr, @@ -204,7 +205,7 @@ onewaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy) } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opNonmutatingAsync( nullptr, @@ -244,7 +245,7 @@ onewaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy) } #ifdef ICE_CPP11_MAPPING { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); p->ice_pingAsync(nullptr, [=](exception_ptr e) { diff --git a/cpp/test/Ice/operations/TwowaysAMI.cpp b/cpp/test/Ice/operations/TwowaysAMI.cpp index 462670b423a..1a40355816b 100644 --- a/cpp/test/Ice/operations/TwowaysAMI.cpp +++ b/cpp/test/Ice/operations/TwowaysAMI.cpp @@ -32,7 +32,10 @@ using namespace Test; namespace { -class CallbackBase : public Ice::LocalObject +class CallbackBase +#ifndef ICE_CPP11_MAPPING +: public Ice::LocalObject +#endif { public: @@ -71,8 +74,6 @@ private: bool _called; }; -typedef IceUtil::Handle<CallbackBase> CallbackBasePtr; - class Callback : public CallbackBase { public: @@ -1033,7 +1034,7 @@ private: Ice::CommunicatorPtr _communicator; }; -typedef IceUtil::Handle<Callback> CallbackPtr; +ICE_DEFINE_PTR(CallbackPtr, Callback); } @@ -1059,7 +1060,7 @@ void twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& p) { { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->ice_pingAsync( [&]() @@ -1077,7 +1078,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->ice_isAAsync( Test::MyClass::ice_staticId(), @@ -1090,13 +1091,13 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& Ice::Callback_Object_ice_isAPtr callback = Ice::newCallback_Object_ice_isA(cb, &Callback::isA, &Callback::exCB); - p->begin_ice_isA(Test::MyClass::ice_staticId(), callback); + p->begin_ice_isA(Test::MyClass::ice_staticId(), callback); #endif cb->check(); } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->ice_idAsync( [&](string id) @@ -1114,7 +1115,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->ice_idsAsync( [&](vector<string> ids) @@ -1122,7 +1123,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& cb->ids(move(ids)); }, makeExceptionClosure(cb)); - + #else Ice::Callback_Object_ice_idsPtr callback = Ice::newCallback_Object_ice_ids(cb, &Callback::ids, @@ -1133,7 +1134,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opVoidAsync( [&]() @@ -1141,7 +1142,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& cb->opVoid(); }, makeExceptionClosure(cb)); - + #else Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, &Callback::opVoid, @@ -1152,7 +1153,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opByteAsync(Ice::Byte(0xff), Ice::Byte(0x0f), [&](Ice::Byte b1, Ice::Byte b2) @@ -1170,7 +1171,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opBoolAsync(true, false, [&](bool b1, bool b2) @@ -1188,7 +1189,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opShortIntLongAsync(10, 11, 12, [&](long long int l1, short s1, int i1, long long int l2) @@ -1205,7 +1206,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opFloatDoubleAsync(3.14f, 1.1E10, [&](double d1, float f1, double d2) @@ -1222,7 +1223,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opStringAsync("hello", "world", [&](string s1, string s2) @@ -1240,7 +1241,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opMyEnumAsync(MyEnum::enum2, [&](MyEnum e1, MyEnum e2) @@ -1258,7 +1259,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback(communicator); + CallbackPtr cb = ICE_MAKE_SHARED(Callback, communicator); #ifdef ICE_CPP11_MAPPING p->opMyClassAsync(p, [&](shared_ptr<MyClassPrx> c1, shared_ptr<MyClassPrx> c2, shared_ptr<MyClassPrx> c3) @@ -1285,7 +1286,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& si2.e = ICE_ENUM(Test::MyEnum, enum2); si2.s.s = "def"; - CallbackPtr cb = new Callback(communicator); + CallbackPtr cb = ICE_MAKE_SHARED(Callback, communicator); #ifdef ICE_CPP11_MAPPING p->opStructAsync(si1, si2, [&](Test::Structure si3, Test::Structure si4) @@ -1316,7 +1317,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& bsi2.push_back(Ice::Byte(0xf3)); bsi2.push_back(Ice::Byte(0xf4)); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opByteSAsync(bsi1, bsi2, [&](Test::ByteS bsi3, Test::ByteS bsi4) @@ -1343,7 +1344,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& bsi2.push_back(false); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opBoolSAsync(bsi1, bsi2, [&](Test::BoolS bsi3, Test::BoolS bsi4) @@ -1378,7 +1379,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& lsi.push_back(30); lsi.push_back(20); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opShortIntLongSAsync(ssi, isi, lsi, [&](Test::LongS lsi1, Test::ShortS ssi1, Test::IntS isi1, Test::LongS lsi2) @@ -1405,7 +1406,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi.push_back(Ice::Double(1.2E10)); dsi.push_back(Ice::Double(1.3E10)); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opFloatDoubleSAsync(fsi, dsi, [&](Test::DoubleS dsi1, Test::FloatS fsi1, Test::DoubleS dsi2) @@ -1431,7 +1432,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& ssi2.push_back("xyz"); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opStringSAsync(ssi1, ssi2, [&](Test::StringS ssi3, Test::StringS ssi4) @@ -1463,7 +1464,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& bsi2[1].push_back(Ice::Byte(0xf2)); bsi2[1].push_back(Ice::Byte(0xf1)); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opByteSSAsync(bsi1, bsi2, [&](Test::ByteSS bsi3, Test::ByteSS bsi4) @@ -1495,7 +1496,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& bsi2[0].push_back(false); bsi2[0].push_back(true); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opBoolSSAsync(bsi1, bsi2, [&](Test::BoolSS bsi3, Test::BoolSS bsi4) @@ -1529,7 +1530,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& lsi[0].push_back(496); lsi[0].push_back(1729); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opShortIntLongSSAsync(ssi, isi, lsi, [&](Test::LongSS lsi1, Test::ShortSS ssi1, Test::IntSS isi1, Test::LongSS lsi2) @@ -1559,7 +1560,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi[0].push_back(Ice::Double(1.2E10)); dsi[0].push_back(Ice::Double(1.3E10)); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opFloatDoubleSSAsync(fsi, dsi, [&](Test::DoubleSS dsi1, Test::FloatSS fsi1, Test::DoubleSS dsi2) @@ -1587,7 +1588,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& ssi2[2].push_back("xyz"); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opStringSSAsync(ssi1, ssi2, [&](Test::StringSS ssi3, Test::StringSS ssi4) @@ -1612,7 +1613,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& di2[11] = false; di2[101] = true; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opByteBoolDAsync(di1, di2, [&](Test::ByteBoolD di3, Test::ByteBoolD di4) @@ -1637,7 +1638,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& di2[111] = -100; di2[1101] = 0; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opShortIntDAsync(di1, di2, [&](Test::ShortIntD di3, Test::ShortIntD di4) @@ -1662,7 +1663,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& di2[999999120] = Ice::Float(-100.4); di2[999999130] = Ice::Float(0.5); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opLongFloatDAsync(di1, di2, [&](Test::LongFloatD di3, Test::LongFloatD di4) @@ -1687,7 +1688,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& di2["FOO"] = "abc -100.4"; di2["BAR"] = "abc 0.5"; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opStringStringDAsync(di1, di2, [&](Test::StringStringD di3, Test::StringStringD di4) @@ -1712,7 +1713,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& di2["qwerty"] = ICE_ENUM(Test::MyEnum, enum3); di2["Hello!!"] = ICE_ENUM(Test::MyEnum, enum2); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opStringMyEnumDAsync(di1, di2, [&](Test::StringMyEnumD di3, Test::StringMyEnumD di4) @@ -1742,7 +1743,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& di2[s22] = ICE_ENUM(Test::MyEnum, enum3); di2[s23] = ICE_ENUM(Test::MyEnum, enum2); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opMyStructMyEnumDAsync(di1, di2, [&](Test::MyStructMyEnumD di3, Test::MyStructMyEnumD di4) @@ -1779,7 +1780,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi1[1] = di2; dsi2[0] = di3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opByteBoolDSAsync(dsi1, dsi2, [&](Test::ByteBoolDS dsi3, Test::ByteBoolDS dsi4) @@ -1815,7 +1816,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi1[1] = di2; dsi2[0] = di3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opShortIntDSAsync(dsi1, dsi2, [&](Test::ShortIntDS dsi3, Test::ShortIntDS dsi4) @@ -1851,7 +1852,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi1[1] = di2; dsi2[0] = di3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opLongFloatDSAsync(dsi1, dsi2, [&](Test::LongFloatDS dsi3, Test::LongFloatDS dsi4) @@ -1887,7 +1888,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi1[1] = di2; dsi2[0] = di3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opStringStringDSAsync(dsi1, dsi2, [&](Test::StringStringDS dsi3, Test::StringStringDS dsi4) @@ -1895,7 +1896,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& cb->opStringStringDS(move(dsi3), move(dsi4)); }, makeExceptionClosure(cb)); - + #else Test::Callback_MyClass_opStringStringDSPtr callback = Test::newCallback_MyClass_opStringStringDS(cb, &Callback::opStringStringDS, &Callback::exCB); @@ -1924,7 +1925,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi1[1] = di2; dsi2[0] = di3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opStringMyEnumDSAsync(dsi1, dsi2, [&](Test::StringMyEnumDS dsi3, Test::StringMyEnumDS dsi4) @@ -1958,7 +1959,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi1[1] = di2; dsi2[0] = di3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opMyEnumStringDSAsync(dsi1, dsi2, [&](Test::MyEnumStringDS dsi3, Test::MyEnumStringDS dsi4) @@ -2000,7 +2001,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi1[1] = di2; dsi2[0] = di3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opMyStructMyEnumDSAsync(dsi1, dsi2, [&](Test::MyStructMyEnumDS dsi3, MyStructMyEnumDS dsi4) @@ -2034,7 +2035,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1[Ice::Byte(0x22)] = si2; sdi2[Ice::Byte(0xf1)] = si3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opByteByteSDAsync(sdi1, sdi2, [&](Test::ByteByteSD sdi3, Test::ByteByteSD sdi4) @@ -2067,7 +2068,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1[true] = si2; sdi2[false] = si1; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opBoolBoolSDAsync(sdi1, sdi2, [&](Test::BoolBoolSD sdi3, Test::BoolBoolSD sdi4) @@ -2103,7 +2104,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1[2] = si2; sdi2[4] = si3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opShortShortSDAsync(sdi1, sdi2, [&](Test::ShortShortSD sdi3, Test::ShortShortSD sdi4) @@ -2139,7 +2140,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1[200] = si2; sdi2[400] = si3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opIntIntSDAsync(sdi1, sdi2, [&](Test::IntIntSD sdi3, Test::IntIntSD sdi4) @@ -2175,7 +2176,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1[999999991] = si2; sdi2[999999992] = si3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opLongLongSDAsync(sdi1, sdi2, [&](Test::LongLongSD sdi3, Test::LongLongSD sdi4) @@ -2211,7 +2212,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1["ABC"] = si2; sdi2["aBc"] = si3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opStringFloatSDAsync(sdi1, sdi2, [&](Test::StringFloatSD sdi3, Test::StringFloatSD sdi4) @@ -2247,7 +2248,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1["Goodbye"] = si2; sdi2[""] = si3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opStringDoubleSDAsync(sdi1, sdi2, [&](Test::StringDoubleSD sdi3, Test::StringDoubleSD sdi4) @@ -2285,7 +2286,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1["def"] = si2; sdi2["ghi"] = si3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opStringStringSDAsync(sdi1, sdi2, [&](Test::StringStringSD sdi3, Test::StringStringSD sdi4) @@ -2321,7 +2322,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1[ICE_ENUM(Test::MyEnum, enum2)] = si2; sdi2[ICE_ENUM(Test::MyEnum, enum1)] = si3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opMyEnumMyEnumSDAsync(sdi1, sdi2, [&](Test::MyEnumMyEnumSD sdi3, Test::MyEnumMyEnumSD sdi4) @@ -2347,7 +2348,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& { s.push_back(i); } - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opIntSAsync(s, [&](Test::IntS s1) @@ -2597,7 +2598,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& { Ice::Double d = 1278312346.0 / 13.0; Test::DoubleS ds(5, d); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opDoubleMarshalingAsync(d, ds, [&]() @@ -2614,7 +2615,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opIdempotentAsync( [&]() @@ -2631,7 +2632,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opNonmutatingAsync( [&]() @@ -2650,7 +2651,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& { Test::MyDerivedClassPrxPtr derived = ICE_CHECKED_CAST(Test::MyDerivedClassPrx, p); test(derived); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING derived->opDerivedAsync( [&]() @@ -2669,7 +2670,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& #ifdef ICE_CPP11_MAPPING { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->ice_pingAsync(); try { @@ -2689,7 +2690,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->ice_isAAsync(Test::MyClass::ice_staticId()); try { @@ -2707,7 +2708,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->ice_idAsync(); try { @@ -2725,7 +2726,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->ice_idsAsync(); try { @@ -2743,7 +2744,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opVoidAsync(); try { @@ -2762,7 +2763,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opByteAsync(Ice::Byte(0xff), Ice::Byte(0x0f)); try { @@ -2781,7 +2782,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opBoolAsync(true, false); try { @@ -2800,7 +2801,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opShortIntLongAsync(10, 11, 12); try { @@ -2819,7 +2820,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opFloatDoubleAsync(3.14f, 1.1E10); try { @@ -2838,7 +2839,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opStringAsync("hello", "world"); try { @@ -2857,7 +2858,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opMyEnumAsync(Test::MyEnum::enum2); try { @@ -2876,7 +2877,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback(communicator); + CallbackPtr cb = ICE_MAKE_SHARED(Callback, communicator); auto f = p->opMyClassAsync(p); try { @@ -2904,7 +2905,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& si2.e = ICE_ENUM(Test::MyEnum, enum2); si2.s.s = "def"; - CallbackPtr cb = new Callback(communicator); + CallbackPtr cb = ICE_MAKE_SHARED(Callback, communicator); auto f = p->opStructAsync(si1, si2); try { @@ -2936,7 +2937,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& bsi2.push_back(Ice::Byte(0xf3)); bsi2.push_back(Ice::Byte(0xf4)); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opByteSAsync(bsi1, bsi2); try { @@ -2964,7 +2965,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& bsi2.push_back(false); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opBoolSAsync(bsi1, bsi2); try { @@ -3000,7 +3001,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& lsi.push_back(30); lsi.push_back(20); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opShortIntLongSAsync(ssi, isi, lsi); try { @@ -3029,7 +3030,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi.push_back(Ice::Double(1.2E10)); dsi.push_back(Ice::Double(1.3E10)); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opFloatDoubleSAsync(fsi, dsi); try { @@ -3057,7 +3058,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& ssi2.push_back("xyz"); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opStringSAsync(ssi1, ssi2); try { @@ -3090,7 +3091,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& bsi2[1].push_back(Ice::Byte(0xf2)); bsi2[1].push_back(Ice::Byte(0xf1)); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opByteSSAsync(bsi1, bsi2); try { @@ -3121,7 +3122,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi[0].push_back(Ice::Double(1.2E10)); dsi[0].push_back(Ice::Double(1.3E10)); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opFloatDoubleSSAsync(fsi, dsi); try { @@ -3151,7 +3152,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& ssi2[2].push_back("xyz"); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opStringSSAsync(ssi1, ssi2); try { @@ -3178,7 +3179,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& di2[11] = false; di2[101] = true; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opByteBoolDAsync(di1, di2); try { @@ -3205,7 +3206,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& di2[111] = -100; di2[1101] = 0; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opShortIntDAsync(di1, di2); try { @@ -3232,7 +3233,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& di2[999999120] = Ice::Float(-100.4); di2[999999130] = Ice::Float(0.5); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opLongFloatDAsync(di1, di2); try { @@ -3259,7 +3260,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& di2["FOO"] = "abc -100.4"; di2["BAR"] = "abc 0.5"; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opStringStringDAsync(di1, di2); try { @@ -3286,7 +3287,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& di2["qwerty"] = ICE_ENUM(Test::MyEnum, enum3); di2["Hello!!"] = ICE_ENUM(Test::MyEnum, enum2); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opStringMyEnumDAsync(di1, di2); try { @@ -3318,7 +3319,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& di2[s22] = ICE_ENUM(Test::MyEnum, enum3); di2[s23] = ICE_ENUM(Test::MyEnum, enum2); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opMyStructMyEnumDAsync(di1, di2); try { @@ -3357,7 +3358,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi1[1] = di2; dsi2[0] = di3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opByteBoolDSAsync(dsi1, dsi2); try { @@ -3395,7 +3396,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi1[1] = di2; dsi2[0] = di3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opShortIntDSAsync(dsi1, dsi2); try { @@ -3433,7 +3434,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi1[1] = di2; dsi2[0] = di3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opLongFloatDSAsync(dsi1, dsi2); try { @@ -3471,7 +3472,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi1[1] = di2; dsi2[0] = di3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opStringStringDSAsync(dsi1, dsi2); try { @@ -3509,7 +3510,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi1[1] = di2; dsi2[0] = di3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opStringMyEnumDSAsync(dsi1, dsi2); try { @@ -3545,7 +3546,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi1[1] = di2; dsi2[0] = di3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opMyEnumStringDSAsync(dsi1, dsi2); try { @@ -3589,7 +3590,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi1[1] = di2; dsi2[0] = di3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opMyStructMyEnumDSAsync(dsi1, dsi2); try { @@ -3625,7 +3626,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1[Ice::Byte(0x22)] = si2; sdi2[Ice::Byte(0xf1)] = si3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opByteByteSDAsync(sdi1, sdi2); try { @@ -3660,7 +3661,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1[true] = si2; sdi2[false] = si1; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opBoolBoolSDAsync(sdi1, sdi2); try { @@ -3698,7 +3699,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1[2] = si2; sdi2[4] = si3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opShortShortSDAsync(sdi1, sdi2); try { @@ -3736,7 +3737,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1[200] = si2; sdi2[400] = si3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opIntIntSDAsync(sdi1, sdi2); try { @@ -3774,7 +3775,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1[999999991] = si2; sdi2[999999992] = si3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opLongLongSDAsync(sdi1, sdi2); try { @@ -3812,7 +3813,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1["ABC"] = si2; sdi2["aBc"] = si3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opStringFloatSDAsync(sdi1, sdi2); try { @@ -3850,7 +3851,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1["Goodbye"] = si2; sdi2[""] = si3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opStringDoubleSDAsync(sdi1, sdi2); try { @@ -3890,7 +3891,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1["def"] = si2; sdi2["ghi"] = si3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opStringStringSDAsync(sdi1, sdi2); try { @@ -3929,7 +3930,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& sdi1[ICE_ENUM(Test::MyEnum, enum2)] = si2; sdi2[ICE_ENUM(Test::MyEnum, enum1)] = si3; - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opMyEnumMyEnumSDAsync(sdi1, sdi2); try { @@ -3957,7 +3958,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& { s.push_back(i); } - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opIntSAsync(s); try { @@ -3978,7 +3979,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& { Ice::Double d = 1278312346.0 / 13.0; Test::DoubleS ds(5, d); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opDoubleMarshalingAsync(d, ds); try { @@ -3997,7 +3998,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opIdempotentAsync(); try { @@ -4016,7 +4017,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opNonmutatingAsync(); try { @@ -4037,7 +4038,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& { Test::MyDerivedClassPrxPtr derived = ICE_CHECKED_CAST(Test::MyDerivedClassPrx, p); test(derived); - CallbackPtr cb = new Callback; + CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = derived->opDerivedAsync(); try { diff --git a/cpp/test/Ice/retry/SystemFailure.h b/cpp/test/Ice/retry/SystemFailure.h index ad54020f8a0..01967bb85ec 100644 --- a/cpp/test/Ice/retry/SystemFailure.h +++ b/cpp/test/Ice/retry/SystemFailure.h @@ -29,7 +29,12 @@ public: return "SystemFailure"; } -#ifndef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_MAPPING + virtual IceUtil::Exception* ice_cloneImpl() const + { + return new SystemFailure(*this); + } +#else virtual SystemException* ice_clone() const { return new SystemFailure(*this); @@ -40,6 +45,7 @@ public: { throw SystemFailure(*this); } + }; #endif diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux b/cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux index ee163c6b302..762aee25735 100644 --- a/cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux +++ b/cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux @@ -1,5 +1,6 @@ 0 IceUtil::Exception::Exception(char const*, int) in - 1 IceUtil::NullHandleException::NullHandleException(char const*, int) in + 1 IceUtil::ExceptionHelper<IceUtil::NullHandleException>::ExceptionHelper(char const*, int) in + 2 IceUtil::NullHandleException::NullHandleException(char const*, int) in client client client diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux.libbacktrace+ b/cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux.libbacktrace+ index 50a457a9437..defa822ab16 100644 --- a/cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux.libbacktrace+ +++ b/cpp/test/IceUtil/stacktrace/StackTrace.debug.Linux.libbacktrace+ @@ -1,9 +1,10 @@ 0 IceUtil::Exception::Exception(char const*, int) at - 1 IceUtil::NullHandleException::NullHandleException(char const*, int) at - 2 fifth at - 3 forth at - 4 third at - 5 second at - 6 first at - 7 main at - 8 + 1 IceUtil::ExceptionHelper<IceUtil::NullHandleException>::ExceptionHelper(char const*, int) at + 2 IceUtil::NullHandleException::NullHandleException(char const*, int) at + 3 fifth at + 4 forth at + 5 third at + 6 second at + 7 first at + 8 main at + 9 diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.debug.OSX b/cpp/test/IceUtil/stacktrace/StackTrace.debug.OSX index c23878ec002..674c86e7d6d 100644 --- a/cpp/test/IceUtil/stacktrace/StackTrace.debug.OSX +++ b/cpp/test/IceUtil/stacktrace/StackTrace.debug.OSX @@ -1,10 +1,11 @@ - 0 IceUtil::Exception::Exception(char const*, int) in libIce.3.7a3.dylib - 1 IceUtil::NullHandleException::NullHandleException(char const*, int) in libIce.3.7a3.dylib - 2 IceUtil::NullHandleException::NullHandleException(char const*, int) in libIce.3.7a3.dylib - 3 (anonymous namespace)::Thrower::fifth() in client - 4 (anonymous namespace)::Thrower::forth() in client - 5 (anonymous namespace)::Thrower::third() in client - 6 (anonymous namespace)::Thrower::second() in client - 7 (anonymous namespace)::Thrower::first() in client - 8 main in client - 9 start in libdyld.dylib
\ No newline at end of file + 0 IceUtil::Exception::Exception(char const*, int) in + 1 IceUtil::ExceptionHelper<IceUtil::NullHandleException>::ExceptionHelper(char const*, int) in + 2 IceUtil::NullHandleException::NullHandleException(char const*, int) in + 3 IceUtil::NullHandleException::NullHandleException(char const*, int) in + 4 (anonymous namespace)::Thrower::fifth() in client + 5 (anonymous namespace)::Thrower::forth() in client + 6 (anonymous namespace)::Thrower::third() in client + 7 (anonymous namespace)::Thrower::second() in client + 8 (anonymous namespace)::Thrower::first() in client + 9 main in client + 10 start in libdyld.dylib diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.debug.Win32 b/cpp/test/IceUtil/stacktrace/StackTrace.debug.Win32 index e0eed48a151..0539f10185a 100644 --- a/cpp/test/IceUtil/stacktrace/StackTrace.debug.Win32 +++ b/cpp/test/IceUtil/stacktrace/StackTrace.debug.Win32 @@ -1,8 +1,9 @@ 0 IceUtil::Exception::Exception - 1 IceUtil::NullHandleException::NullHandleException - 2 `anonymous namespace'::Thrower::fifth - 3 `anonymous namespace'::Thrower::forth - 4 `anonymous namespace'::Thrower::third - 5 `anonymous namespace'::Thrower::second - 6 `anonymous namespace'::Thrower::first - 7 main + 1 IceUtil::ExceptionHelper<IceUtil::NullHandleException>::ExceptionHelper + 2 IceUtil::NullHandleException::NullHandleException + 3 `anonymous namespace'::Thrower::fifth + 4 `anonymous namespace'::Thrower::forth + 5 `anonymous namespace'::Thrower::third + 6 `anonymous namespace'::Thrower::second + 7 `anonymous namespace'::Thrower::first + 8 main diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc120.Win32 b/cpp/test/IceUtil/stacktrace/StackTrace.release-vc120.Win32 index 823da2cd4fc..19ab443db12 100644 --- a/cpp/test/IceUtil/stacktrace/StackTrace.release-vc120.Win32 +++ b/cpp/test/IceUtil/stacktrace/StackTrace.release-vc120.Win32 @@ -1,4 +1,5 @@ 0 IceUtil::Exception::Exception - 1 IceUtil::NullHandleException::NullHandleException - 2 `anonymous namespace'::Thrower::fifth - 3 main + 1 IceUtil::ExceptionHelper<IceUtil::NullHandleException>::ExceptionHelper + 2 IceUtil::NullHandleException::NullHandleException + 3 `anonymous namespace'::Thrower::fifth + 4 main diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.release.Linux b/cpp/test/IceUtil/stacktrace/StackTrace.release.Linux index a2fde31ab7a..5081f4b77a4 100644 --- a/cpp/test/IceUtil/stacktrace/StackTrace.release.Linux +++ b/cpp/test/IceUtil/stacktrace/StackTrace.release.Linux @@ -1,3 +1,4 @@ 0 IceUtil::Exception::Exception(char const*, int) - 1 IceUtil::NullHandleException::NullHandleException(char const*, int) + 1 IceUtil::ExceptionHelper<IceUtil::NullHandleException>::ExceptionHelper(char const*, int) + 2 IceUtil::NullHandleException::NullHandleException(char const*, int) client diff --git a/cpp/test/include/TestCommon.h b/cpp/test/include/TestCommon.h index 7ec0469f25b..e8605f5c1b4 100644 --- a/cpp/test/include/TestCommon.h +++ b/cpp/test/include/TestCommon.h @@ -161,7 +161,12 @@ public: return "::TestFailedException"; } -#ifndef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_MAPPING + virtual IceUtil::Exception* ice_cloneImpl() const + { + return new TestFailedException(*this); + } +#else virtual TestFailedException* ice_clone() const { return new TestFailedException(*this); |