diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 103 | ||||
-rw-r--r-- | cpp/src/Ice/TraceUtil.cpp | 3 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 20 |
3 files changed, 79 insertions, 47 deletions
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 4e6ec8120ba..9957c3b4353 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -40,15 +40,18 @@ 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, ::IceProxy::Ice::Object*& d) +IceInternal::checkedCast(::IceProxy::Ice::Object* b, const string& f, ::IceProxy::Ice::Object*& d) { - d = b; + // TODO: Check facet + d = new ::IceProxy::Ice::Object; + d->__copyFromWithFacet(b, f); } void -IceInternal::uncheckedCast(::IceProxy::Ice::Object* b, ::IceProxy::Ice::Object*& d) +IceInternal::uncheckedCast(::IceProxy::Ice::Object* b, const string& f, ::IceProxy::Ice::Object*& d) { - d = b; + d = new ::IceProxy::Ice::Object; + d->__copyFromWithFacet(b, f); } bool @@ -77,6 +80,32 @@ IceProxy::Ice::Object::_isA(const string& s) } } +bool +IceProxy::Ice::Object::_hasFacet(const string& s) +{ + int __cnt = 0; + while (true) + { + try + { + Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); + return __del->_hasFacet(s); + } + catch (const LocationForward& __ex) + { + __locationForward(__ex); + } + catch (const NonRepeatable& __ex) + { + __handleException(*__ex.get(), __cnt); + } + catch (const LocalException& __ex) + { + __handleException(__ex, __cnt); + } + } +} + void IceProxy::Ice::Object::_ping() { @@ -290,9 +319,15 @@ IceProxy::Ice::Object::__reference() const } void -IceProxy::Ice::Object::__copyTo(::IceProxy::Ice::Object* to) const +IceProxy::Ice::Object::__copyFrom(const ::IceProxy::Ice::Object* from) { - to->setup(_reference); + setup(from->__reference()); +} + +void +IceProxy::Ice::Object::__copyFromWithFacet(const ::IceProxy::Ice::Object* from, const string& facet) +{ + setup(from->__reference()->changeFacet(facet)); } void @@ -393,14 +428,6 @@ IceProxy::Ice::Object::__rethrowException(const LocalException& ex) ex._throw(); } -IceProxy::Ice::Object::Object() -{ -} - -IceProxy::Ice::Object::~Object() -{ -} - Handle< ::IceDelegate::Ice::Object> IceProxy::Ice::Object::__getDelegate() { @@ -447,21 +474,30 @@ IceProxy::Ice::Object::setup(const ReferencePtr& ref) _reference = ref; } -IceDelegate::Ice::Object::Object() -{ -} - -IceDelegate::Ice::Object::~Object() +bool +IceDelegateM::Ice::Object::_isA(const string& s) { + Outgoing __out(__emitter, __reference); + BasicStream* __is = __out.is(); + BasicStream* __os = __out.os(); + __os->write("_isA"); + __os->write(s); + if (!__out.invoke()) + { + throw ::Ice::UnknownUserException(__FILE__, __LINE__); + } + bool __ret; + __is->read(__ret); + return __ret; } bool -IceDelegateM::Ice::Object::_isA(const string& s) +IceDelegateM::Ice::Object::_hasFacet(const string& s) { Outgoing __out(__emitter, __reference); BasicStream* __is = __out.is(); BasicStream* __os = __out.os(); - __os->write("_isA"); + __os->write("_hasFacet"); __os->write(s); if (!__out.invoke()) { @@ -490,14 +526,6 @@ IceDelegateM::Ice::Object::_flush() __emitter->flushBatchRequest(); } -IceDelegateM::Ice::Object::Object() -{ -} - -IceDelegateM::Ice::Object::~Object() -{ -} - void IceDelegateM::Ice::Object::setup(const ReferencePtr& ref) { @@ -558,10 +586,17 @@ 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() { - Direct __direct(__adapter, __reference, "_isA"); + Direct __direct(__adapter, __reference, "_ping"); __direct.servant()->_ping(); } @@ -571,14 +606,6 @@ IceDelegateD::Ice::Object::_flush() // Nothing to do for direct delegates } -IceDelegateD::Ice::Object::Object() -{ -} - -IceDelegateD::Ice::Object::~Object() -{ -} - void IceDelegateD::Ice::Object::setup(const ReferencePtr& ref, const ObjectAdapterPtr& adapter) { diff --git a/cpp/src/Ice/TraceUtil.cpp b/cpp/src/Ice/TraceUtil.cpp index 0707a7ffcb5..4f3b9a7e0db 100644 --- a/cpp/src/Ice/TraceUtil.cpp +++ b/cpp/src/Ice/TraceUtil.cpp @@ -104,6 +104,9 @@ IceInternal::traceRequest(const char* heading, const BasicStream& str, const ::I string identity; stream.read(identity); s << "\nidentity = " << identity; + string facet; + stream.read(facet); + s << "\nfacet = " << facet; string operation; stream.read(operation); s << "\noperation name = " << operation; diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 19e1c1f2d35..1ad8d17faea 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -1953,8 +1953,10 @@ Slice::Gen::IceVisitor::visitClassDecl(const ClassDeclPtr& p) H << nl << _dllExport << "void incRef(::IceProxy" << scoped << "*);"; H << nl << _dllExport << "void decRef(::IceProxy" << scoped << "*);"; H << sp; - H << nl << _dllExport << "void checkedCast(::IceProxy::Ice::Object*, ::IceProxy" << scoped << "*&);"; - H << nl << _dllExport << "void uncheckedCast(::IceProxy::Ice::Object*, ::IceProxy" << scoped << "*&);"; + H << nl << _dllExport << "void checkedCast(::IceProxy::Ice::Object*, const ::std::string&, ::IceProxy" + << scoped << "*&);"; + H << nl << _dllExport << "void uncheckedCast(::IceProxy::Ice::Object*, const ::std::string&, ::IceProxy" + << scoped << "*&);"; } } @@ -1985,25 +1987,25 @@ Slice::Gen::IceVisitor::visitClassDefStart(const ClassDefPtr& p) C << nl << "p->__decRef();"; C << eb; C << sp; - C << nl << "void" << nl << "IceInternal::checkedCast(::IceProxy::Ice::Object* b, ::IceProxy" << scoped - << "*& d)"; + C << nl << "void" << nl << "IceInternal::checkedCast(::IceProxy::Ice::Object* b, const ::std::string& f, " + << "::IceProxy" << scoped << "*& d)"; C << sb; C << nl << "d = dynamic_cast< ::IceProxy" << scoped << "*>(b);"; C << nl << "if (!d && b->_isA(\"" << scoped << "\"))"; C << sb; C << nl << "d = new ::IceProxy" << scoped << ';'; - C << nl << "b->__copyTo(d);"; + C << nl << "d->__copyFromWithFacet(b, f);"; C << eb; C << eb; C << sp; - C << nl << "void" << nl << "IceInternal::uncheckedCast(::IceProxy::Ice::Object* b, ::IceProxy" << scoped - << "*& d)"; + C << nl << "void" << nl << "IceInternal::uncheckedCast(::IceProxy::Ice::Object* b, const ::std::string& f, " + << "::IceProxy" << scoped << "*& d)"; C << sb; C << nl << "d = dynamic_cast< ::IceProxy" << scoped << "*>(b);"; C << nl << "if (!d)"; C << sb; C << nl << "d = new ::IceProxy" << scoped << ';'; - C << nl << "b->__copyTo(d);"; + C << nl << "d->__copyFromWithFacet(b, f);"; C << eb; C << eb; } @@ -2085,7 +2087,7 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p) C << nl << "else"; C << sb; C << nl << "v = new ::IceProxy" << scoped << ';'; - C << nl << "proxy->__copyTo(v.get());"; + C << nl << "v->__copyFrom(proxy.get());"; C << eb; C << eb; |