diff options
author | Jose <jose@zeroc.com> | 2015-12-23 15:00:34 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2015-12-23 15:00:34 +0100 |
commit | 3c63f0acf41df01688fea2fb5fb5cec4d5eb4710 (patch) | |
tree | c2a0a25ac956b4ce9a4edc8d37df1c24476e40fd /cpp | |
parent | C++11 metrics fixes (diff) | |
download | ice-3c63f0acf41df01688fea2fb5fb5cec4d5eb4710.tar.bz2 ice-3c63f0acf41df01688fea2fb5fb5cec4d5eb4710.tar.xz ice-3c63f0acf41df01688fea2fb5fb5cec4d5eb4710.zip |
Fixes related to EnableSharedFromThis
Diffstat (limited to 'cpp')
30 files changed, 77 insertions, 92 deletions
diff --git a/cpp/include/Glacier2/SessionHelper.h b/cpp/include/Glacier2/SessionHelper.h index b18f04ccf69..128311b8e84 100644 --- a/cpp/include/Glacier2/SessionHelper.h +++ b/cpp/include/Glacier2/SessionHelper.h @@ -33,7 +33,7 @@ namespace Glacier2 const int GLACIER2_SSL_PORT = 4064; const int GLACIER2_TCP_PORT = 4063; -class GLACIER2_API SessionHelper : public IceUtil::Shared +class GLACIER2_API SessionHelper : public virtual ICE_SHARED { public: @@ -51,7 +51,7 @@ public: }; ICE_DEFINE_PTR(SessionHelperPtr, SessionHelper); -class GLACIER2_API SessionCallback : virtual public IceUtil::Shared +class GLACIER2_API SessionCallback : virtual public ICE_SHARED { public: @@ -65,7 +65,7 @@ ICE_DEFINE_PTR(SessionCallbackPtr, SessionCallback); class SessionThreadCallback; -class GLACIER2_API SessionFactoryHelper : public ICE_ENABLE_SHARED_FROM_THIS(SessionFactoryHelper) +class GLACIER2_API SessionFactoryHelper : public Ice::EnableSharedFromThis<SessionFactoryHelper> { friend class SessionThreadCallback; // To access thread functions diff --git a/cpp/include/Ice/AsyncResult.h b/cpp/include/Ice/AsyncResult.h index 674206e7a06..5b4e7d3f347 100644 --- a/cpp/include/Ice/AsyncResult.h +++ b/cpp/include/Ice/AsyncResult.h @@ -172,7 +172,7 @@ namespace IceInternal // // Base class for all callbacks. // -class ICE_API CallbackBase : public ICE_ENABLE_SHARED_FROM_THIS(CallbackBase) +class ICE_API CallbackBase : public Ice::EnableSharedFromThis<CallbackBase> { public: diff --git a/cpp/include/Ice/BatchRequestInterceptor.h b/cpp/include/Ice/BatchRequestInterceptor.h index 8ec188cf829..79c0f6b5e64 100644 --- a/cpp/include/Ice/BatchRequestInterceptor.h +++ b/cpp/include/Ice/BatchRequestInterceptor.h @@ -35,7 +35,7 @@ public: virtual const Ice::ObjectPrxPtr& getProxy() const = 0; }; -class BatchRequestInterceptor : public ICE_ENABLE_SHARED_FROM_THIS(BatchRequestInterceptor) +class BatchRequestInterceptor : public ICE_SHARED { public: diff --git a/cpp/include/Ice/MetricsAdminI.h b/cpp/include/Ice/MetricsAdminI.h index 818a7f94155..7f0f191b0cc 100644 --- a/cpp/include/Ice/MetricsAdminI.h +++ b/cpp/include/Ice/MetricsAdminI.h @@ -47,7 +47,7 @@ namespace IceInternal class ICE_API MetricsMapI; ICE_DEFINE_PTR(MetricsMapIPtr, MetricsMapI); -class ICE_API MetricsMapI : public ICE_ENABLE_SHARED_FROM_THIS(MetricsMapI) +class ICE_API MetricsMapI : public Ice::EnableSharedFromThis<MetricsMapI> { public: @@ -119,7 +119,12 @@ protected: const std::vector<RegExpPtr> _reject; }; -class ICE_API MetricsMapFactory : public ICE_LOCAL_OBJECT +class ICE_API MetricsMapFactory : +#ifdef ICE_CPP11_MAPPING + virtual public Ice::VirtualEnableSharedFromThisBase +#else + public Ice::LocalObject +#endif { public: @@ -149,7 +154,12 @@ public: class EntryT; ICE_DEFINE_PTR(EntryTPtr, EntryT); - class EntryT : public ICE_LOCAL_OBJECT + class EntryT : +#ifdef ICE_CPP11_MAPPING + virtual public Ice::VirtualEnableSharedFromThisBase +#else + public Ice::LocalObject +#endif { public: diff --git a/cpp/include/Ice/VirtualShared.h b/cpp/include/Ice/VirtualShared.h index ad9d19a8d76..ab7cab7ad7f 100644 --- a/cpp/include/Ice/VirtualShared.h +++ b/cpp/include/Ice/VirtualShared.h @@ -15,7 +15,7 @@ namespace Ice { -#ifdef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_MAPPING // C++11 class VirtualEnableSharedFromThisBase : public std::enable_shared_from_this<VirtualEnableSharedFromThisBase> { @@ -23,7 +23,7 @@ public: virtual ~VirtualEnableSharedFromThisBase() = default; }; -template<typename T> class VirtualEnableSharedFromThis : public virtual VirtualEnableSharedFromThisBase +template<typename T> class EnableSharedFromThis : public virtual VirtualEnableSharedFromThisBase { public: @@ -36,12 +36,8 @@ public: }; # define ICE_SHARED Ice::VirtualEnableSharedFromThisBase -# define ICE_LOCAL_OBJECT Ice::VirtualEnableSharedFromThisBase -# define ICE_ENABLE_SHARED_FROM_THIS(T) Ice::VirtualEnableSharedFromThis<T> -#else - -// C++98 +#else // C++98 template<typename T> class EnableSharedFromThis : virtual public IceUtil::Shared { @@ -54,8 +50,6 @@ public: }; # define ICE_SHARED IceUtil::Shared -# define ICE_LOCAL_OBJECT Ice::LocalObject -# define ICE_ENABLE_SHARED_FROM_THIS(T) Ice::EnableSharedFromThis<T> #endif diff --git a/cpp/include/IceSSL/Plugin.h b/cpp/include/IceSSL/Plugin.h index 0578f689fbf..79b27af95fc 100644 --- a/cpp/include/IceSSL/Plugin.h +++ b/cpp/include/IceSSL/Plugin.h @@ -169,7 +169,7 @@ ICE_DEFINE_PTR(CertificatePtr, Certificate); // // A representation of a PublicKey. // -class ICE_SSL_API PublicKey : public ICE_ENABLE_SHARED_FROM_THIS(PublicKey) +class ICE_SSL_API PublicKey : public Ice::EnableSharedFromThis<PublicKey> { public: @@ -267,7 +267,7 @@ private: // This convenience class is a wrapper around a native certificate. // The interface is inspired by java.security.cert.X509Certificate. // -class ICE_SSL_API Certificate : public ICE_ENABLE_SHARED_FROM_THIS(Certificate) +class ICE_SSL_API Certificate : public Ice::EnableSharedFromThis<Certificate> { public: @@ -480,7 +480,7 @@ ICE_DEFINE_PTR(WSSNativeConnectionInfoPtr, WSSNativeConnectionInfo); // An application can customize the certificate verification process // by implementing the CertificateVerifier interface. // -class ICE_SSL_API CertificateVerifier : public ICE_ENABLE_SHARED_FROM_THIS(CertificateVerifier) +class ICE_SSL_API CertificateVerifier : public Ice::EnableSharedFromThis<CertificateVerifier> { public: @@ -507,7 +507,7 @@ ICE_DEFINE_PTR(CertificateVerifierPtr, CertificateVerifier); // IceSSL.DelayInit=1), configure the PasswordPrompt, then manually // initialize the plug-in. // -class ICE_SSL_API PasswordPrompt : public ICE_ENABLE_SHARED_FROM_THIS(PasswordPrompt) +class ICE_SSL_API PasswordPrompt : public Ice::EnableSharedFromThis<PasswordPrompt> { public: diff --git a/cpp/src/Glacier2Lib/SessionHelper.cpp b/cpp/src/Glacier2Lib/SessionHelper.cpp index 7563520329b..541267fb51f 100644 --- a/cpp/src/Glacier2Lib/SessionHelper.cpp +++ b/cpp/src/Glacier2Lib/SessionHelper.cpp @@ -20,7 +20,7 @@ using namespace std; namespace Glacier2 { -class SessionThreadCallback : public ICE_ENABLE_SHARED_FROM_THIS(SessionThreadCallback) +class SessionThreadCallback : public Ice::EnableSharedFromThis<SessionThreadCallback> { public: @@ -82,10 +82,7 @@ private: const Glacier2::SessionCallbackPtr _callback; }; -class SessionHelperI : public Glacier2::SessionHelper -#ifdef ICE_CPP11_MAPPING - , public enable_shared_from_this<SessionHelperI> -#endif +class SessionHelperI : public Glacier2::SessionHelper, public Ice::EnableSharedFromThis<SessionHelperI> { public: @@ -227,13 +224,13 @@ SessionHelperI::destroy() // We destroy the communicator to trigger the immediate // failure of the connection establishment. // - IceUtil::ThreadPtr destroyCommunicator = new DestroyCommunicator(ICE_SHARED_FROM_THIS); + IceUtil::ThreadPtr destroyCommunicator = new DestroyCommunicator(shared_from_this()); _threadCB = ICE_NULLPTR; destroyCommunicator->start(); return; } - IceUtil::ThreadPtr destroyInternal = new DestroyInternal(ICE_SHARED_FROM_THIS, _threadCB, _callback); + IceUtil::ThreadPtr destroyInternal = new DestroyInternal(shared_from_this(), _threadCB, _callback); _session = ICE_NULLPTR; _connected = false; @@ -666,13 +663,13 @@ SessionHelperI::connectImpl(const ConnectStrategyPtr& factory) catch(const Ice::LocalException& ex) { _destroy = true; - IceUtil::ThreadPtr thread = new DispatchCallThread(ICE_SHARED_FROM_THIS, new ConnectFailed(_callback, ICE_SHARED_FROM_THIS, ex), 0); + IceUtil::ThreadPtr thread = new DispatchCallThread(shared_from_this(), new ConnectFailed(_callback, shared_from_this(), ex), 0); _threadCB->add(this, thread); thread->start(); return; } - IceUtil::ThreadPtr thread = new ConnectThread(_callback, ICE_SHARED_FROM_THIS, factory, _communicator, _finder); + IceUtil::ThreadPtr thread = new ConnectThread(_callback, shared_from_this(), factory, _communicator, _finder); _threadCB->add(this, thread); thread->start(); } @@ -795,7 +792,7 @@ SessionHelperI::connected(const Glacier2::RouterPrxPtr& router, const Glacier2:: Ice::ConnectionPtr connection = _router->ice_getCachedConnection(); assert(connection); connection->setACM(acmTimeout, IceUtil::None, Ice::HeartbeatAlways); - connection->setCallback(ICE_MAKE_SHARED(ConnectionCallbackI, ICE_SHARED_FROM_THIS)); + connection->setCallback(ICE_MAKE_SHARED(ConnectionCallbackI, shared_from_this())); } } } @@ -806,11 +803,11 @@ SessionHelperI::connected(const Glacier2::RouterPrxPtr& router, const Glacier2:: // connected() is only called from the ConnectThread so it is ok to // call destroyInternal here. // - destroyInternal(new Disconnected(ICE_SHARED_FROM_THIS, _callback)); + destroyInternal(new Disconnected(shared_from_this(), _callback)); } else { - dispatchCallback(new Connected(_callback, ICE_SHARED_FROM_THIS), conn); + dispatchCallback(new Connected(_callback, shared_from_this()), conn); } } @@ -1119,7 +1116,7 @@ Glacier2::SessionFactoryHelper::connect() { IceUtil::Mutex::Lock sync(_mutex); session = ICE_MAKE_SHARED(SessionHelperI, - ICE_MAKE_SHARED(SessionThreadCallback, ICE_SHARED_FROM_THIS), + ICE_MAKE_SHARED(SessionThreadCallback, shared_from_this()), _callback, createInitData(), getRouterFinderStr(), @@ -1138,7 +1135,7 @@ Glacier2::SessionFactoryHelper::connect(const string& user, const string& passw { IceUtil::Mutex::Lock sync(_mutex); session = ICE_MAKE_SHARED(SessionHelperI, - ICE_MAKE_SHARED(SessionThreadCallback, ICE_SHARED_FROM_THIS), + ICE_MAKE_SHARED(SessionThreadCallback, shared_from_this()), _callback, createInitData(), getRouterFinderStr(), diff --git a/cpp/src/Ice/ACM.h b/cpp/src/Ice/ACM.h index 9d8f151daac..0290a179ab8 100644 --- a/cpp/src/Ice/ACM.h +++ b/cpp/src/Ice/ACM.h @@ -51,7 +51,7 @@ public: }; class FactoryACMMonitor : public ACMMonitor, public ::IceUtil::Mutex, - public ICE_ENABLE_SHARED_FROM_THIS(FactoryACMMonitor) + public Ice::EnableSharedFromThis<FactoryACMMonitor> { public: @@ -87,7 +87,7 @@ private: }; class ConnectionACMMonitor : public ACMMonitor, public ::IceUtil::Mutex, - public ICE_ENABLE_SHARED_FROM_THIS(ConnectionACMMonitor) + public Ice::EnableSharedFromThis<ConnectionACMMonitor> { public: diff --git a/cpp/src/Ice/CollocatedRequestHandler.h b/cpp/src/Ice/CollocatedRequestHandler.h index 87b5cb37966..c4baefb7b30 100644 --- a/cpp/src/Ice/CollocatedRequestHandler.h +++ b/cpp/src/Ice/CollocatedRequestHandler.h @@ -40,7 +40,7 @@ class OutgoingAsync; class CollocatedRequestHandler : public RequestHandler, public ResponseHandler, private IceUtil::Monitor<IceUtil::Mutex>, - public ICE_ENABLE_SHARED_FROM_THIS(CollocatedRequestHandler) + public Ice::EnableSharedFromThis<CollocatedRequestHandler> { public: diff --git a/cpp/src/Ice/CommunicatorI.h b/cpp/src/Ice/CommunicatorI.h index 173effb3beb..7db2f29d330 100644 --- a/cpp/src/Ice/CommunicatorI.h +++ b/cpp/src/Ice/CommunicatorI.h @@ -23,7 +23,7 @@ namespace Ice class CommunicatorI; ICE_DEFINE_PTR(CommunicatorIPtr, CommunicatorI); -class CommunicatorI : public ICE_ENABLE_SHARED_FROM_THIS(CommunicatorI), +class CommunicatorI : public EnableSharedFromThis<CommunicatorI>, public Communicator { public: diff --git a/cpp/src/Ice/ConnectRequestHandler.h b/cpp/src/Ice/ConnectRequestHandler.h index e8d61faa379..1dd13dd5274 100644 --- a/cpp/src/Ice/ConnectRequestHandler.h +++ b/cpp/src/Ice/ConnectRequestHandler.h @@ -31,7 +31,7 @@ class ConnectRequestHandler : public RequestHandler, public Reference::GetConnectionCallback, public RouterInfo::AddProxyCallback, public IceUtil::Monitor<IceUtil::Mutex>, - public ICE_ENABLE_SHARED_FROM_THIS(ConnectRequestHandler) + public Ice::EnableSharedFromThis<ConnectRequestHandler> { public: diff --git a/cpp/src/Ice/ConnectionFactory.h b/cpp/src/Ice/ConnectionFactory.h index 2259a872d9d..ecf170aed68 100644 --- a/cpp/src/Ice/ConnectionFactory.h +++ b/cpp/src/Ice/ConnectionFactory.h @@ -89,7 +89,7 @@ private: class ConnectCallback : public Ice::ConnectionI::StartCallback, public IceInternal::EndpointI_connectors, - public ICE_ENABLE_SHARED_FROM_THIS(IceInternal::OutgoingConnectionFactory::ConnectCallback) + public Ice::EnableSharedFromThis<IceInternal::OutgoingConnectionFactory::ConnectCallback> { public: @@ -170,7 +170,7 @@ private: class IncomingConnectionFactory : public EventHandler, public Ice::ConnectionI::StartCallback, public IceUtil::Monitor<IceUtil::Mutex>, - public ICE_ENABLE_SHARED_FROM_THIS(IncomingConnectionFactory) + public Ice::EnableSharedFromThis<IncomingConnectionFactory> { public: diff --git a/cpp/src/Ice/ConnectionI.h b/cpp/src/Ice/ConnectionI.h index 75ec43765a7..e920b894a62 100644 --- a/cpp/src/Ice/ConnectionI.h +++ b/cpp/src/Ice/ConnectionI.h @@ -68,7 +68,7 @@ class ConnectionI : public Connection, public IceInternal::ResponseHandler, public IceInternal::CancellationHandler, public IceUtil::Monitor<IceUtil::Mutex>, - public ICE_ENABLE_SHARED_FROM_THIS(ConnectionI) + public EnableSharedFromThis<ConnectionI> { class Observer : public IceInternal::ObserverHelperT<Ice::Instrumentation::ConnectionObserver> { diff --git a/cpp/src/Ice/ConnectionRequestHandler.h b/cpp/src/Ice/ConnectionRequestHandler.h index 3cfd5954d11..864facc6f91 100644 --- a/cpp/src/Ice/ConnectionRequestHandler.h +++ b/cpp/src/Ice/ConnectionRequestHandler.h @@ -19,7 +19,7 @@ namespace IceInternal { class ConnectionRequestHandler : public RequestHandler, - public ICE_ENABLE_SHARED_FROM_THIS(ConnectionRequestHandler) + public Ice::EnableSharedFromThis<ConnectionRequestHandler> { public: diff --git a/cpp/src/Ice/EventHandler.h b/cpp/src/Ice/EventHandler.h index cb3f1f3299d..a11299d9326 100644 --- a/cpp/src/Ice/EventHandler.h +++ b/cpp/src/Ice/EventHandler.h @@ -21,7 +21,12 @@ namespace IceInternal { -class ICE_API EventHandler : virtual public ICE_LOCAL_OBJECT +class ICE_API EventHandler : +#ifdef ICE_CPP11_MAPPING + virtual public Ice::VirtualEnableSharedFromThisBase +#else + virtual public Ice::LocalObject +#endif { public: diff --git a/cpp/src/Ice/IPEndpointI.h b/cpp/src/Ice/IPEndpointI.h index d2f79a78051..8e5e033647f 100644 --- a/cpp/src/Ice/IPEndpointI.h +++ b/cpp/src/Ice/IPEndpointI.h @@ -43,7 +43,7 @@ private: const EndpointIPtr _endpoint; }; -class ICE_API IPEndpointI : public EndpointI, public ICE_ENABLE_SHARED_FROM_THIS(IPEndpointI) +class ICE_API IPEndpointI : public EndpointI, public Ice::EnableSharedFromThis<IPEndpointI> { public: diff --git a/cpp/src/Ice/LoggerAdminI.cpp b/cpp/src/Ice/LoggerAdminI.cpp index 1ddee852655..de1e29429c9 100644 --- a/cpp/src/Ice/LoggerAdminI.cpp +++ b/cpp/src/Ice/LoggerAdminI.cpp @@ -138,7 +138,7 @@ public: typedef IceUtil::Handle<Job> JobPtr; -class LoggerAdminLoggerI : public ICE_ENABLE_SHARED_FROM_THIS(LoggerAdminLoggerI), public IceInternal::LoggerAdminLogger +class LoggerAdminLoggerI : public Ice::EnableSharedFromThis<LoggerAdminLoggerI>, public IceInternal::LoggerAdminLogger { public: diff --git a/cpp/src/Ice/ObjectAdapterFactory.h b/cpp/src/Ice/ObjectAdapterFactory.h index d9e52a9a7bb..3277259f7f8 100644 --- a/cpp/src/Ice/ObjectAdapterFactory.h +++ b/cpp/src/Ice/ObjectAdapterFactory.h @@ -19,7 +19,8 @@ namespace IceInternal { -class ObjectAdapterFactory : public ICE_ENABLE_SHARED_FROM_THIS(ObjectAdapterFactory), public ::IceUtil::Monitor< ::IceUtil::RecMutex> +class ObjectAdapterFactory : public Ice::EnableSharedFromThis<ObjectAdapterFactory>, + public ::IceUtil::Monitor< ::IceUtil::RecMutex> { public: diff --git a/cpp/src/Ice/ObjectAdapterI.h b/cpp/src/Ice/ObjectAdapterI.h index 5addbdfe846..3678276d147 100644 --- a/cpp/src/Ice/ObjectAdapterI.h +++ b/cpp/src/Ice/ObjectAdapterI.h @@ -38,7 +38,7 @@ namespace Ice class ObjectAdapterI; ICE_DEFINE_PTR(ObjectAdapterIPtr, ObjectAdapterI); -class ObjectAdapterI : public ICE_ENABLE_SHARED_FROM_THIS(ObjectAdapterI), +class ObjectAdapterI : public EnableSharedFromThis<ObjectAdapterI>, public ObjectAdapter, public IceUtil::Monitor<IceUtil::RecMutex> { diff --git a/cpp/src/Ice/OpaqueEndpointI.h b/cpp/src/Ice/OpaqueEndpointI.h index 516e4dcfcf3..caa67476a8e 100644 --- a/cpp/src/Ice/OpaqueEndpointI.h +++ b/cpp/src/Ice/OpaqueEndpointI.h @@ -16,7 +16,7 @@ namespace IceInternal { -class OpaqueEndpointI : public EndpointI, public ICE_ENABLE_SHARED_FROM_THIS(OpaqueEndpointI) +class OpaqueEndpointI : public EndpointI, public Ice::EnableSharedFromThis<OpaqueEndpointI> { public: diff --git a/cpp/src/Ice/RetryQueue.h b/cpp/src/Ice/RetryQueue.h index a7355c4f1b1..295bd1ce700 100644 --- a/cpp/src/Ice/RetryQueue.h +++ b/cpp/src/Ice/RetryQueue.h @@ -24,7 +24,7 @@ namespace IceInternal class RetryTask : public IceUtil::TimerTask, public CancellationHandler, - public ICE_ENABLE_SHARED_FROM_THIS(RetryTask) + public Ice::EnableSharedFromThis<RetryTask> { public: diff --git a/cpp/src/Ice/WSEndpoint.h b/cpp/src/Ice/WSEndpoint.h index debb77644c7..6c11da77775 100644 --- a/cpp/src/Ice/WSEndpoint.h +++ b/cpp/src/Ice/WSEndpoint.h @@ -31,7 +31,7 @@ public: virtual Ice::EndpointInfoPtr getWSInfo(const std::string&) const = 0; }; -class WSEndpoint : public EndpointI, public ICE_ENABLE_SHARED_FROM_THIS(WSEndpoint) +class WSEndpoint : public EndpointI, public Ice::EnableSharedFromThis<WSEndpoint> { public: diff --git a/cpp/src/IceDiscovery/LookupI.cpp b/cpp/src/IceDiscovery/LookupI.cpp index d7e9ef7b1fa..57e433b22b0 100644 --- a/cpp/src/IceDiscovery/LookupI.cpp +++ b/cpp/src/IceDiscovery/LookupI.cpp @@ -116,11 +116,7 @@ AdapterRequest::finished(const Ice::ObjectPrxPtr& proxy) void AdapterRequest::runTimerTask() { -#ifdef ICE_CPP11_MAPPING - _lookup->adapterRequestTimedOut(dynamic_pointer_cast<AdapterRequest>(shared_from_this())); -#else - _lookup->adapterRequestTimedOut(this); -#endif + _lookup->adapterRequestTimedOut(shared_from_this()); } void @@ -132,11 +128,7 @@ ObjectRequest::response(const Ice::ObjectPrxPtr& proxy) void ObjectRequest::runTimerTask() { -#ifdef ICE_CPP11_MAPPING - _lookup->objectRequestTimedOut(dynamic_pointer_cast<ObjectRequest>(shared_from_this())); -#else - _lookup->objectRequestTimedOut(this); -#endif + _lookup->objectRequestTimedOut(shared_from_this()); } LookupI::LookupI(const LocatorRegistryIPtr& registry, const LookupPrxPtr& lookup, const Ice::PropertiesPtr& properties) : diff --git a/cpp/src/IceDiscovery/LookupI.h b/cpp/src/IceDiscovery/LookupI.h index 7e603ef8688..49350c52106 100644 --- a/cpp/src/IceDiscovery/LookupI.h +++ b/cpp/src/IceDiscovery/LookupI.h @@ -24,9 +24,7 @@ class LookupI; #ifdef ICE_CPP11_MAPPING -template<class T> class Request : - public IceUtil::TimerTask, - public std::enable_shared_from_this<Request<T>> +template<class T> class Request : public IceUtil::TimerTask { public: @@ -70,7 +68,7 @@ protected: std::vector<std::function<void (const std::shared_ptr<::Ice::ObjectPrx>&)>> _callbacks; }; -class ObjectRequest : public Request<Ice::Identity> +class ObjectRequest : public Request<Ice::Identity>, public Ice::EnableSharedFromThis<ObjectRequest> { public: @@ -87,7 +85,7 @@ private: }; typedef std::shared_ptr<ObjectRequest> ObjectRequestPtr; -class AdapterRequest : public Request<std::string> +class AdapterRequest : public Request<std::string>, public Ice::EnableSharedFromThis<AdapterRequest> { public: @@ -161,7 +159,8 @@ protected: std::vector<CB> _callbacks; }; -class ObjectRequest : public RequestT<Ice::Identity, Ice::AMD_Locator_findObjectByIdPtr> +class ObjectRequest : public RequestT<Ice::Identity, Ice::AMD_Locator_findObjectByIdPtr>, + public Ice::EnableSharedFromThis<ObjectRequest> { public: @@ -178,7 +177,7 @@ private: }; typedef IceUtil::Handle<ObjectRequest> ObjectRequestPtr; -class AdapterRequest : public RequestT<std::string, Ice::AMD_Locator_findAdapterByIdPtr> +class AdapterRequest : public RequestT<std::string, Ice::AMD_Locator_findAdapterByIdPtr>, public Ice::EnableSharedFromThis<AdapterRequest> { public: @@ -205,7 +204,7 @@ typedef IceUtil::Handle<AdapterRequest> AdapterRequestPtr; class LookupI : public Lookup, private IceUtil::Mutex, - public ICE_ENABLE_SHARED_FROM_THIS(LookupI) + public Ice::EnableSharedFromThis<LookupI> { public: diff --git a/cpp/src/IceSSL/Certificate.cpp b/cpp/src/IceSSL/Certificate.cpp index 795e1df4f3f..ee814eb420f 100644 --- a/cpp/src/IceSSL/Certificate.cpp +++ b/cpp/src/IceSSL/Certificate.cpp @@ -977,24 +977,11 @@ Certificate::getPublicKey() const { throw CertificateEncodingException(__FILE__, __LINE__, errorToString(err)); } -# ifdef ICE_CPP11_MAPPING - return make_shared<PublicKey>(const_pointer_cast<Certificate>(shared_from_this()), key); -# else - return new PublicKey(const_cast<Certificate*>(this), key); -# endif + return ICE_MAKE_SHARED(PublicKey, shared_from_this(), key); #elif defined(ICE_USE_SCHANNEL) -# ifdef ICE_CPP11_MAPPING - return make_shared<PublicKey>(const_pointer_cast<Certificate>(shared_from_this()), - &_certInfo->SubjectPublicKeyInfo); -# else - return new PublicKey(const_cast<Certificate*>(this), &_certInfo->SubjectPublicKeyInfo); -# endif + return ICE_MAKE_SHARED(PublicKey, shared_from_this(), &_certInfo->SubjectPublicKeyInfo); #else -# ifdef ICE_CPP11_MAPPING - return make_shared<PublicKey>(const_pointer_cast<Certificate>(shared_from_this()), X509_get_pubkey(_cert)); -# else - return new PublicKey(const_cast<Certificate*>(this), X509_get_pubkey(_cert)); -# endif + return ICE_MAKE_SHARED(PublicKey, shared_from_this(), X509_get_pubkey(_cert)); #endif } diff --git a/cpp/test/Ice/acm/AllTests.cpp b/cpp/test/Ice/acm/AllTests.cpp index 970ad0711ec..7a1982df020 100644 --- a/cpp/test/Ice/acm/AllTests.cpp +++ b/cpp/test/Ice/acm/AllTests.cpp @@ -24,7 +24,7 @@ toString(int value) return os.str(); } -class LoggerI : public ICE_ENABLE_SHARED_FROM_THIS(LoggerI), +class LoggerI : public Ice::EnableSharedFromThis<LoggerI>, public Ice::Logger, private IceUtil::Mutex { diff --git a/cpp/test/Ice/admin/TestI.cpp b/cpp/test/Ice/admin/TestI.cpp index 64ab0d191af..17f7efc441b 100644 --- a/cpp/test/Ice/admin/TestI.cpp +++ b/cpp/test/Ice/admin/TestI.cpp @@ -19,7 +19,7 @@ namespace // A no-op Logger, used when testing the Logger Admin // -class NullLogger : public Ice::Logger, public ICE_ENABLE_SHARED_FROM_THIS(NullLogger) +class NullLogger : public Ice::Logger, public Ice::EnableSharedFromThis<NullLogger> { public: @@ -46,7 +46,7 @@ public: virtual Ice::LoggerPtr cloneWithPrefix(const string&) { - return ICE_SHARED_FROM_THIS; + return shared_from_this(); } }; diff --git a/cpp/test/Ice/background/EndpointI.h b/cpp/test/Ice/background/EndpointI.h index 2261cbb0205..9e2d1d2a7a8 100644 --- a/cpp/test/Ice/background/EndpointI.h +++ b/cpp/test/Ice/background/EndpointI.h @@ -18,7 +18,7 @@ class EndpointI; ICE_DEFINE_PTR(EndpointIPtr, EndpointI); -class EndpointI : public IceInternal::EndpointI, public ICE_ENABLE_SHARED_FROM_THIS(EndpointI) +class EndpointI : public IceInternal::EndpointI, public Ice::EnableSharedFromThis<EndpointI> { public: diff --git a/cpp/test/Ice/dispatcher/AllTests.cpp b/cpp/test/Ice/dispatcher/AllTests.cpp index e42055fcdc9..f22928ea7b3 100644 --- a/cpp/test/Ice/dispatcher/AllTests.cpp +++ b/cpp/test/Ice/dispatcher/AllTests.cpp @@ -18,7 +18,7 @@ using namespace std; namespace { -class Callback : public ICE_ENABLE_SHARED_FROM_THIS(Callback) +class Callback : public ICE_SHARED { public: diff --git a/cpp/test/Ice/slicing/objects/AllTests.cpp b/cpp/test/Ice/slicing/objects/AllTests.cpp index 516f255ce43..512ac967ae0 100644 --- a/cpp/test/Ice/slicing/objects/AllTests.cpp +++ b/cpp/test/Ice/slicing/objects/AllTests.cpp @@ -52,7 +52,7 @@ private: bool _called; }; -class Callback : public CallbackBase, public ICE_ENABLE_SHARED_FROM_THIS(Callback) +class Callback : public CallbackBase, public Ice::EnableSharedFromThis<Callback> { public: |