diff options
Diffstat (limited to 'cpp/src/Ice/Proxy.cpp')
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 130 |
1 files changed, 75 insertions, 55 deletions
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 3bfdc14610a..f380d58efd7 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -9,6 +9,7 @@ #include <Ice/Proxy.h> #include <Ice/ProxyFactory.h> +#include <Ice/ReferenceFactory.h> #include <Ice/Object.h> #include <Ice/ObjectAdapterFactory.h> #include <Ice/Outgoing.h> @@ -582,32 +583,38 @@ IceProxy::Ice::Object::ice_endpointSelection(EndpointSelectionType newType) cons } } +bool +IceProxy::Ice::Object::ice_getSecure() const +{ + return _reference->getSecure(); +} + ObjectPrx -IceProxy::Ice::Object::ice_twoway() const +IceProxy::Ice::Object::ice_secure(bool b) const { - ReferencePtr ref = _reference->changeMode(Reference::ModeTwoway); - if(ref == _reference) + if(b == _reference->getSecure()) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy(new ::IceProxy::Ice::Object()); - proxy->setup(ref); + proxy->setup(_reference->changeSecure(b)); return proxy; } } -bool -IceProxy::Ice::Object::ice_isTwoway() const +RouterPrx +IceProxy::Ice::Object::ice_getRouter() const { - return _reference->getMode() == Reference::ModeTwoway; + RouterInfoPtr ri = _reference->getRouterInfo(); + return ri ? ri->getRouter() : RouterPrx(); } ObjectPrx -IceProxy::Ice::Object::ice_oneway() const +IceProxy::Ice::Object::ice_router(const RouterPrx& router) const { - ReferencePtr ref = _reference->changeMode(Reference::ModeOneway); + ReferencePtr ref = _reference->changeRouter(router); if(ref == _reference) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); @@ -620,16 +627,17 @@ IceProxy::Ice::Object::ice_oneway() const } } -bool -IceProxy::Ice::Object::ice_isOneway() const +LocatorPrx +IceProxy::Ice::Object::ice_getLocator() const { - return _reference->getMode() == Reference::ModeOneway; + LocatorInfoPtr ri = _reference->getLocatorInfo(); + return ri ? ri->getLocator() : LocatorPrx(); } ObjectPrx -IceProxy::Ice::Object::ice_batchOneway() const +IceProxy::Ice::Object::ice_locator(const LocatorPrx& locator) const { - ReferencePtr ref = _reference->changeMode(Reference::ModeBatchOneway); + ReferencePtr ref = _reference->changeLocator(locator); if(ref == _reference) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); @@ -643,123 +651,135 @@ IceProxy::Ice::Object::ice_batchOneway() const } bool -IceProxy::Ice::Object::ice_isBatchOneway() const +IceProxy::Ice::Object::ice_getCollocationOptimization() const { - return _reference->getMode() == Reference::ModeBatchOneway; + return _reference->getCollocationOptimization(); } ObjectPrx -IceProxy::Ice::Object::ice_datagram() const +IceProxy::Ice::Object::ice_collocationOptimization(bool b) const { - ReferencePtr ref = _reference->changeMode(Reference::ModeDatagram); - if(ref == _reference) + if(b == _reference->getCollocationOptimization()) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy(new ::IceProxy::Ice::Object()); - proxy->setup(ref); + proxy->setup(_reference->changeCollocationOptimization(b)); return proxy; } } -bool -IceProxy::Ice::Object::ice_isDatagram() const -{ - return _reference->getMode() == Reference::ModeDatagram; -} - ObjectPrx -IceProxy::Ice::Object::ice_batchDatagram() const +IceProxy::Ice::Object::ice_twoway() const { - ReferencePtr ref = _reference->changeMode(Reference::ModeBatchDatagram); - if(ref == _reference) + if(_reference->getMode() == Reference::ModeTwoway) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy(new ::IceProxy::Ice::Object()); - proxy->setup(ref); + proxy->setup(_reference->changeMode(Reference::ModeTwoway)); return proxy; } } bool -IceProxy::Ice::Object::ice_isBatchDatagram() const +IceProxy::Ice::Object::ice_isTwoway() const { - return _reference->getMode() == Reference::ModeBatchDatagram; + return _reference->getMode() == Reference::ModeTwoway; } ObjectPrx -IceProxy::Ice::Object::ice_secure(bool b) const +IceProxy::Ice::Object::ice_oneway() const { - ReferencePtr ref = _reference->changeSecure(b); - if(ref == _reference) + if(_reference->getMode() == Reference::ModeOneway) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy(new ::IceProxy::Ice::Object()); - proxy->setup(ref); + proxy->setup(_reference->changeMode(Reference::ModeOneway)); return proxy; } } +bool +IceProxy::Ice::Object::ice_isOneway() const +{ + return _reference->getMode() == Reference::ModeOneway; +} + ObjectPrx -IceProxy::Ice::Object::ice_compress(bool b) const +IceProxy::Ice::Object::ice_batchOneway() const { - ReferencePtr ref = _reference->changeCompress(b); - if(ref == _reference) + if(_reference->getMode() == Reference::ModeBatchOneway) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy(new ::IceProxy::Ice::Object()); - proxy->setup(ref); + proxy->setup(_reference->changeMode(Reference::ModeBatchOneway)); return proxy; } } +bool +IceProxy::Ice::Object::ice_isBatchOneway() const +{ + return _reference->getMode() == Reference::ModeBatchOneway; +} + ObjectPrx -IceProxy::Ice::Object::ice_timeout(int t) const +IceProxy::Ice::Object::ice_datagram() const { - ReferencePtr ref = _reference->changeTimeout(t); - if(ref == _reference) + if(_reference->getMode() == Reference::ModeDatagram) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy(new ::IceProxy::Ice::Object()); - proxy->setup(ref); + proxy->setup(_reference->changeMode(Reference::ModeDatagram)); return proxy; } } +bool +IceProxy::Ice::Object::ice_isDatagram() const +{ + return _reference->getMode() == Reference::ModeDatagram; +} + ObjectPrx -IceProxy::Ice::Object::ice_router(const RouterPrx& router) const +IceProxy::Ice::Object::ice_batchDatagram() const { - ReferencePtr ref = _reference->changeRouter(router); - if(ref == _reference) + if(_reference->getMode() == Reference::ModeBatchDatagram) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy(new ::IceProxy::Ice::Object()); - proxy->setup(ref); + proxy->setup(_reference->changeMode(Reference::ModeBatchDatagram)); return proxy; } } +bool +IceProxy::Ice::Object::ice_isBatchDatagram() const +{ + return _reference->getMode() == Reference::ModeBatchDatagram; +} + ObjectPrx -IceProxy::Ice::Object::ice_locator(const LocatorPrx& locator) const +IceProxy::Ice::Object::ice_compress(bool b) const { - ReferencePtr ref = _reference->changeLocator(locator); + ReferencePtr ref = _reference->changeCompress(b); if(ref == _reference) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); @@ -773,9 +793,9 @@ IceProxy::Ice::Object::ice_locator(const LocatorPrx& locator) const } ObjectPrx -IceProxy::Ice::Object::ice_collocationOptimization(bool b) const +IceProxy::Ice::Object::ice_timeout(int t) const { - ReferencePtr ref = _reference->changeCollocationOptimization(b); + ReferencePtr ref = _reference->changeTimeout(t); if(ref == _reference) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); @@ -1007,10 +1027,10 @@ IceProxy::Ice::Object::__getDelegate() // using a router, then add this proxy to the router info // object. // - RoutableReferencePtr rr = RoutableReferencePtr::dynamicCast(_reference); - if(rr && rr->getRouterInfo()) + RouterInfoPtr ri = _reference->getRouterInfo(); + if(ri) { - rr->getRouterInfo()->addProxy(this); + ri->addProxy(this); } } |