diff options
author | Bernard Normier <bernard@zeroc.com> | 2016-07-19 18:39:55 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2016-07-19 18:39:55 -0400 |
commit | 09ff416d9060c022b63fe4a33dc7d995153a44ba (patch) | |
tree | d017c47d6be74fb45282c82bf5bd77953f737d8a /cpp/src | |
parent | Merge remote-tracking branch 'origin/3.6' (diff) | |
download | ice-09ff416d9060c022b63fe4a33dc7d995153a44ba.tar.bz2 ice-09ff416d9060c022b63fe4a33dc7d995153a44ba.tar.xz ice-09ff416d9060c022b63fe4a33dc7d995153a44ba.zip |
New UserExceptionFactory for C++11
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/FactoryTable.cpp | 9 | ||||
-rw-r--r-- | cpp/src/Ice/InputStream.cpp | 18 |
2 files changed, 19 insertions, 8 deletions
diff --git a/cpp/src/Ice/FactoryTable.cpp b/cpp/src/Ice/FactoryTable.cpp index 78b8a1c8b2b..27d6a8a5d8e 100644 --- a/cpp/src/Ice/FactoryTable.cpp +++ b/cpp/src/Ice/FactoryTable.cpp @@ -12,18 +12,21 @@ using namespace std; +#ifndef ICE_CPP11_MAPPING Ice::UserExceptionFactory::~UserExceptionFactory() { // Out of line to avoid weak vtable } +#endif + // // Add a factory to the exception factory table. // If the factory is present already, increment its reference count. // void -IceInternal::FactoryTable::addExceptionFactory(const string& t, const Ice::UserExceptionFactoryPtr& f) +IceInternal::FactoryTable::addExceptionFactory(const string& t, ICE_IN(ICE_USER_EXCEPTION_FACTORY) f) { IceUtil::Mutex::Lock lock(_m); assert(f); @@ -41,12 +44,12 @@ IceInternal::FactoryTable::addExceptionFactory(const string& t, const Ice::UserE // // Return the exception factory for a given type ID // -Ice::UserExceptionFactoryPtr +ICE_USER_EXCEPTION_FACTORY IceInternal::FactoryTable::getExceptionFactory(const string& t) const { IceUtil::Mutex::Lock lock(_m); EFTable::const_iterator i = _eft.find(t); - return i != _eft.end() ? i->second.first : Ice::UserExceptionFactoryPtr(); + return i != _eft.end() ? i->second.first : ICE_USER_EXCEPTION_FACTORY(); } // diff --git a/cpp/src/Ice/InputStream.cpp b/cpp/src/Ice/InputStream.cpp index 20bba90db7e..2e5dcdf2965 100644 --- a/cpp/src/Ice/InputStream.cpp +++ b/cpp/src/Ice/InputStream.cpp @@ -1403,7 +1403,7 @@ Ice::InputStream::readEnum(Int maxValue) } void -Ice::InputStream::throwException(const UserExceptionFactoryPtr& factory) +Ice::InputStream::throwException(ICE_IN(ICE_USER_EXCEPTION_FACTORY) factory) { initEncaps(); _currentEncaps->decoder->throwException(factory); @@ -1963,7 +1963,7 @@ Ice::InputStream::EncapsDecoder10::read(PatchFunc patchFunc, void* patchAddr) } void -Ice::InputStream::EncapsDecoder10::throwException(const UserExceptionFactoryPtr& factory) +Ice::InputStream::EncapsDecoder10::throwException(ICE_IN(ICE_USER_EXCEPTION_FACTORY) factory) { assert(_sliceType == NoSlice); @@ -1985,7 +1985,7 @@ Ice::InputStream::EncapsDecoder10::throwException(const UserExceptionFactoryPtr& // startSlice(); const string mostDerivedId = _typeId; - UserExceptionFactoryPtr exceptionFactory = factory; + ICE_USER_EXCEPTION_FACTORY exceptionFactory = factory; while(true) { // @@ -2008,7 +2008,11 @@ Ice::InputStream::EncapsDecoder10::throwException(const UserExceptionFactoryPtr& // try { +#ifdef ICE_CPP11_MAPPING + exceptionFactory(_typeId); +#else exceptionFactory->createAndThrow(_typeId); +#endif } catch(UserException& ex) { @@ -2265,7 +2269,7 @@ Ice::InputStream::EncapsDecoder11::read(PatchFunc patchFunc, void* patchAddr) } void -Ice::InputStream::EncapsDecoder11::throwException(const UserExceptionFactoryPtr& factory) +Ice::InputStream::EncapsDecoder11::throwException(ICE_IN(ICE_USER_EXCEPTION_FACTORY) factory) { assert(!_current); @@ -2276,7 +2280,7 @@ Ice::InputStream::EncapsDecoder11::throwException(const UserExceptionFactoryPtr& // startSlice(); const string mostDerivedId = _current->typeId; - UserExceptionFactoryPtr exceptionFactory = factory; + ICE_USER_EXCEPTION_FACTORY exceptionFactory = factory; while(true) { // @@ -2299,7 +2303,11 @@ Ice::InputStream::EncapsDecoder11::throwException(const UserExceptionFactoryPtr& // try { +#ifdef ICE_CPP11_MAPPING + exceptionFactory(_current->typeId); +#else exceptionFactory->createAndThrow(_current->typeId); +#endif } catch(UserException& ex) { |