diff options
author | Bernard Normier <bernard@zeroc.com> | 2016-08-26 16:15:37 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2016-08-26 16:15:37 -0400 |
commit | f7fe523fee0e828b781b9dc010bb0f80ea22853a (patch) | |
tree | ffd913f8c16a56e579dd6f5f97eca08625d3418d /cpp | |
parent | Fix java-compat typo in TestUtil.py (diff) | |
download | ice-f7fe523fee0e828b781b9dc010bb0f80ea22853a.tar.bz2 ice-f7fe523fee0e828b781b9dc010bb0f80ea22853a.tar.xz ice-f7fe523fee0e828b781b9dc010bb0f80ea22853a.zip |
Fixed proxy comparison in C++11
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Ice/LocatorInfo.cpp | 14 | ||||
-rw-r--r-- | cpp/src/Ice/LocatorInfo.h | 11 | ||||
-rw-r--r-- | cpp/src/Ice/RouterInfo.cpp | 18 | ||||
-rw-r--r-- | cpp/src/Ice/RouterInfo.h | 12 |
4 files changed, 23 insertions, 32 deletions
diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp index d13d3f9f54f..03264b5898c 100644 --- a/cpp/src/Ice/LocatorInfo.cpp +++ b/cpp/src/Ice/LocatorInfo.cpp @@ -157,7 +157,7 @@ IceInternal::LocatorManager::get(const LocatorPrxPtr& loc) return 0; } - LocatorPrxPtr locator = ICE_UNCHECKED_CAST(LocatorPrx, loc->ice_locator(0)); // The locator can't be located. + LocatorPrxPtr locator = loc->ice_locator(0); // The locator can't be located. // // TODO: reap unused locator info objects? @@ -165,11 +165,11 @@ IceInternal::LocatorManager::get(const LocatorPrxPtr& loc) IceUtil::Mutex::Lock sync(*this); - map<LocatorPrxPtr, LocatorInfoPtr>::iterator p = _table.end(); + LocatorInfoTable::iterator p = _table.end(); if(_tableHint != _table.end()) { - if(_tableHint->first == locator) + if(targetEqualTo(_tableHint->first, locator)) { p = _tableHint; } @@ -564,21 +564,13 @@ IceInternal::LocatorInfo::destroy() bool IceInternal::LocatorInfo::operator==(const LocatorInfo& rhs) const { -#ifdef ICE_CPP11_MAPPING return Ice::targetEqualTo(_locator, rhs._locator); -#else - return _locator == rhs._locator; -#endif } bool IceInternal::LocatorInfo::operator<(const LocatorInfo& rhs) const { -#ifdef ICE_CPP11_MAPPING return Ice::targetLess(_locator, rhs._locator); -#else - return _locator < rhs._locator; -#endif } LocatorRegistryPrxPtr diff --git a/cpp/src/Ice/LocatorInfo.h b/cpp/src/Ice/LocatorInfo.h index f20f0b71b24..36528f7790d 100644 --- a/cpp/src/Ice/LocatorInfo.h +++ b/cpp/src/Ice/LocatorInfo.h @@ -45,8 +45,15 @@ private: const bool _background; - std::map<Ice::LocatorPrxPtr, LocatorInfoPtr> _table; - std::map<Ice::LocatorPrxPtr, LocatorInfoPtr>::iterator _tableHint; +#ifdef ICE_CPP11_MAPPING + using LocatorInfoTable = std::map<std::shared_ptr<Ice::LocatorPrx>, + LocatorInfoPtr, + Ice::TargetCompare<std::shared_ptr<Ice::LocatorPrx>, std::less>>; +#else + typedef std::map<Ice::LocatorPrx, LocatorInfoPtr> LocatorInfoTable; +#endif + LocatorInfoTable _table; + LocatorInfoTable::iterator _tableHint; std::map<std::pair<Ice::Identity, Ice::EncodingVersion>, LocatorTablePtr> _locatorTables; }; diff --git a/cpp/src/Ice/RouterInfo.cpp b/cpp/src/Ice/RouterInfo.cpp index c5c7b4c5df6..b205b057d7a 100644 --- a/cpp/src/Ice/RouterInfo.cpp +++ b/cpp/src/Ice/RouterInfo.cpp @@ -47,15 +47,15 @@ IceInternal::RouterManager::get(const RouterPrxPtr& rtr) return 0; } - RouterPrxPtr router = ICE_UNCHECKED_CAST(RouterPrx, rtr->ice_router(0)); // The router cannot be routed. + RouterPrxPtr router = rtr->ice_router(0); // The router cannot be routed. IceUtil::Mutex::Lock sync(*this); - map<RouterPrxPtr, RouterInfoPtr>::iterator p = _table.end(); + RouterInfoTable::iterator p = _table.end(); if(_tableHint != _table.end()) { - if(_tableHint->first == router) + if(targetEqualTo(_tableHint->first, router)) { p = _tableHint; } @@ -87,8 +87,8 @@ IceInternal::RouterManager::erase(const RouterPrxPtr& rtr) RouterPrxPtr router = ICE_UNCHECKED_CAST(RouterPrx, rtr->ice_router(ICE_NULLPTR)); // The router cannot be routed. IceUtil::Mutex::Lock sync(*this); - map<RouterPrxPtr, RouterInfoPtr>::iterator p = _table.end(); - if(_tableHint != _table.end() && _tableHint->first == router) + RouterInfoTable::iterator p = _table.end(); + if(_tableHint != _table.end() && targetEqualTo(_tableHint->first, router)) { p = _tableHint; _tableHint = _table.end(); @@ -129,21 +129,13 @@ IceInternal::RouterInfo::destroy() bool IceInternal::RouterInfo::operator==(const RouterInfo& rhs) const { -#ifdef ICE_CPP11_MAPPING return Ice::targetEqualTo(_router, rhs._router); -#else - return _router == rhs._router; -#endif } bool IceInternal::RouterInfo::operator<(const RouterInfo& rhs) const { -#ifdef ICE_CPP11_MAPPING return Ice::targetLess(_router, rhs._router); -#else - return _router < rhs._router; -#endif } vector<EndpointIPtr> diff --git a/cpp/src/Ice/RouterInfo.h b/cpp/src/Ice/RouterInfo.h index 6c9cdc8539f..76b70bb7bd5 100644 --- a/cpp/src/Ice/RouterInfo.h +++ b/cpp/src/Ice/RouterInfo.h @@ -43,15 +43,15 @@ public: private: #ifdef ICE_CPP11_MAPPING - using RouterTableMap = std::map<std::shared_ptr<Ice::RouterPrx>, - RouterInfoPtr, - Ice::TargetCompare<std::shared_ptr<::Ice::RouterPrx>, std::less>>; + using RouterInfoTable = std::map<std::shared_ptr<Ice::RouterPrx>, + RouterInfoPtr, + Ice::TargetCompare<std::shared_ptr<Ice::RouterPrx>, std::less>>; #else - typedef std::map<Ice::RouterPrxPtr, RouterInfoPtr> RouterTableMap; + typedef std::map<Ice::RouterPrx, RouterInfoPtr> RouterInfoTable; #endif - RouterTableMap _table; - RouterTableMap::iterator _tableHint; + RouterInfoTable _table; + RouterInfoTable::iterator _tableHint; }; class RouterInfo : public IceUtil::Shared, public IceUtil::Mutex |