diff options
Diffstat (limited to 'cpp/src/Ice/FactoryTable.cpp')
-rw-r--r-- | cpp/src/Ice/FactoryTable.cpp | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/cpp/src/Ice/FactoryTable.cpp b/cpp/src/Ice/FactoryTable.cpp index 7442ed9ccea..36951aa0cc6 100644 --- a/cpp/src/Ice/FactoryTable.cpp +++ b/cpp/src/Ice/FactoryTable.cpp @@ -8,14 +8,25 @@ // ********************************************************************** #include <Ice/FactoryTable.h> -#include <Ice/ObjectFactory.h> +#include <Ice/ValueFactory.h> + +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 std::string& t, const IceInternal::UserExceptionFactoryPtr& f) +IceInternal::FactoryTable::addExceptionFactory(const string& t, ICE_IN(ICE_USER_EXCEPTION_FACTORY) f) { IceUtil::Mutex::Lock lock(_m); assert(f); @@ -33,12 +44,12 @@ IceInternal::FactoryTable::addExceptionFactory(const std::string& t, const IceIn // // Return the exception factory for a given type ID // -IceInternal::UserExceptionFactoryPtr -IceInternal::FactoryTable::getExceptionFactory(const std::string& t) const +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 : IceInternal::UserExceptionFactoryPtr(); + return i != _eft.end() ? i->second.first : ICE_USER_EXCEPTION_FACTORY(); } // @@ -48,7 +59,7 @@ IceInternal::FactoryTable::getExceptionFactory(const std::string& t) const // entry from the table. // void -IceInternal::FactoryTable::removeExceptionFactory(const std::string& t) +IceInternal::FactoryTable::removeExceptionFactory(const string& t) { IceUtil::Mutex::Lock lock(_m); EFTable::iterator i = _eft.find(t); @@ -62,17 +73,17 @@ IceInternal::FactoryTable::removeExceptionFactory(const std::string& t) } // -// Add a factory to the object factory table. +// Add a factory to the value factory table. // void -IceInternal::FactoryTable::addObjectFactory(const std::string& t, const Ice::ObjectFactoryPtr& f) +IceInternal::FactoryTable::addValueFactory(const string& t, ICE_IN(ICE_VALUE_FACTORY) f) { IceUtil::Mutex::Lock lock(_m); assert(f); - OFTable::iterator i = _oft.find(t); - if(i == _oft.end()) + VFTable::iterator i = _vft.find(t); + if(i == _vft.end()) { - _oft[t] = OFPair(f, 1); + _vft[t] = VFPair(f, 1); } else { @@ -81,41 +92,41 @@ IceInternal::FactoryTable::addObjectFactory(const std::string& t, const Ice::Obj } // -// Return the object factory for a given type ID +// Return the value factory for a given type ID // -Ice::ObjectFactoryPtr -IceInternal::FactoryTable::getObjectFactory(const std::string& t) const +ICE_VALUE_FACTORY +IceInternal::FactoryTable::getValueFactory(const string& t) const { IceUtil::Mutex::Lock lock(_m); - OFTable::const_iterator i = _oft.find(t); - return i != _oft.end() ? i->second.first : Ice::ObjectFactoryPtr(); + VFTable::const_iterator i = _vft.find(t); + return i != _vft.end() ? i->second.first : ICE_VALUE_FACTORY(); } // -// Remove a factory from the object factory table. If the factory +// Remove a factory from the value factory table. If the factory // is not present, do nothing; otherwise, decrement the factory's // reference count if the count drops to zero, remove the factory's // entry from the table. // void -IceInternal::FactoryTable::removeObjectFactory(const std::string& t) +IceInternal::FactoryTable::removeValueFactory(const string& t) { IceUtil::Mutex::Lock lock(_m); - OFTable::iterator i = _oft.find(t); - if(i != _oft.end()) + VFTable::iterator i = _vft.find(t); + if(i != _vft.end()) { if(--i->second.second == 0) { - _oft.erase(i); + _vft.erase(i); } } } // -// Add a factory to the object factory table. +// Add a factory to the value factory table. // void -IceInternal::FactoryTable::addTypeId(int compactId, const std::string& typeId) +IceInternal::FactoryTable::addTypeId(int compactId, const string& typeId) { IceUtil::Mutex::Lock lock(_m); assert(!typeId.empty() && compactId >= 0); @@ -133,12 +144,12 @@ IceInternal::FactoryTable::addTypeId(int compactId, const std::string& typeId) // // Return the type ID for the given compact ID // -std::string +string IceInternal::FactoryTable::getTypeId(int compactId) const { IceUtil::Mutex::Lock lock(_m); TypeIdTable::const_iterator i = _typeIdTable.find(compactId); - return i != _typeIdTable.end() ? i->second.first : std::string(); + return i != _typeIdTable.end() ? i->second.first : string(); } void |