diff options
author | Marc Laukien <marc@zeroc.com> | 2001-10-18 15:34:32 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2001-10-18 15:34:32 +0000 |
commit | 6f32b305b09f6b975db8f6626e851e4104e3c88e (patch) | |
tree | 1f2c1df0c066433b412b7bc16a7db00611efee93 /cpp/src/Ice/Proxy.cpp | |
parent | win fixes (diff) | |
download | ice-6f32b305b09f6b975db8f6626e851e4104e3c88e.tar.bz2 ice-6f32b305b09f6b975db8f6626e851e4104e3c88e.tar.xz ice-6f32b305b09f6b975db8f6626e851e4104e3c88e.zip |
more facet stuff
Diffstat (limited to 'cpp/src/Ice/Proxy.cpp')
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 95 |
1 files changed, 32 insertions, 63 deletions
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index a4353eca0a7..496ffb279be 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -40,48 +40,47 @@ void IceInternal::incRef(::IceDelegateD::Ice::Object* p) { p->__incRef(); } void IceInternal::decRef(::IceDelegateD::Ice::Object* p) { p->__decRef(); } void -IceInternal::checkedCast(::IceProxy::Ice::Object* b, const string& f, ::IceProxy::Ice::Object*& d) +IceInternal::checkedCast(const ObjectPrx& b, const string& f, ObjectPrx& d) { - // TODO: Check facet - d = new ::IceProxy::Ice::Object; - d->__copyFromWithFacet(b, f); -} - -void -IceInternal::uncheckedCast(::IceProxy::Ice::Object* b, const string& f, ::IceProxy::Ice::Object*& d) -{ - d = new ::IceProxy::Ice::Object; - d->__copyFromWithFacet(b, f); -} - -bool -IceProxy::Ice::Object::_isA(const string& s) -{ - int __cnt = 0; - while (true) + d = 0; + if (b) { - try - { - Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); - return __del->_isA(s); - } - catch (const LocationForward& __ex) - { - __locationForward(__ex); - } - catch (const NonRepeatable& __ex) + if (f == b->_getFacet()) { - __handleException(*__ex.get(), __cnt); + d = b; } - catch (const LocalException& __ex) + else { - __handleException(__ex, __cnt); + ObjectPrx bb = b->_newFacet(f); + try + { +#ifdef NDEBUG + bb->_isA("::Ice::Object"); +#else + bool ok = bb->_isA("::Ice::Object"); + assert(ok); +#endif + d = bb; + } + catch (const FacetNotExistException&) + { + } } } } +void +IceInternal::uncheckedCast(const ObjectPrx& b, const string& f, ObjectPrx& d) +{ + d = 0; + if (b) + { + d = b->_newFacet(f); + } +} + bool -IceProxy::Ice::Object::_hasFacet(const string& s) +IceProxy::Ice::Object::_isA(const string& s) { int __cnt = 0; while (true) @@ -89,7 +88,7 @@ IceProxy::Ice::Object::_hasFacet(const string& s) try { Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); - return __del->_hasFacet(s); + return __del->_isA(s); } catch (const LocationForward& __ex) { @@ -325,12 +324,6 @@ IceProxy::Ice::Object::__copyFrom(const ObjectPrx& from) } void -IceProxy::Ice::Object::__copyFromWithFacet(const ObjectPrx& from, const string& facet) -{ - setup(from->__reference()->changeFacet(facet)); -} - -void IceProxy::Ice::Object::__handleException(const LocalException& ex, int& cnt) { JTCSyncT<JTCMutex> sync(*this); @@ -491,23 +484,6 @@ IceDelegateM::Ice::Object::_isA(const string& s) return __ret; } -bool -IceDelegateM::Ice::Object::_hasFacet(const string& s) -{ - Outgoing __out(__emitter, __reference); - BasicStream* __is = __out.is(); - BasicStream* __os = __out.os(); - __os->write("_hasFacet"); - __os->write(s); - if (!__out.invoke()) - { - throw ::Ice::UnknownUserException(__FILE__, __LINE__); - } - bool __ret; - __is->read(__ret); - return __ret; -} - void IceDelegateM::Ice::Object::_ping() { @@ -586,13 +562,6 @@ IceDelegateD::Ice::Object::_isA(const string& s) return __direct.servant()->_isA(s); } -bool -IceDelegateD::Ice::Object::_hasFacet(const string& s) -{ - Direct __direct(__adapter, __reference, "_hasFacet"); - return __direct.servant()->_hasFacet(s); -} - void IceDelegateD::Ice::Object::_ping() { |