diff options
Diffstat (limited to 'cpp/src/Slice/CPlusPlusUtil.cpp')
-rw-r--r-- | cpp/src/Slice/CPlusPlusUtil.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 2f66f9fcbab..3ca1969af42 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -304,25 +304,29 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& if (marshal) { out << nl << "::Ice::ObjectPtr " << obj << " = " << param << ';'; - out << nl << stream << deref << "write(" << obj << ");"; + out << nl << stream << deref << func << obj << ");"; } else { + out << nl << "::Ice::ObjectPtr " << obj << ';'; ClassDefPtr def = cl->definition(); if (def && !def->isAbstract()) { - out << nl << "::Ice::ObjectPtr " << obj << " = new " << cl->scoped() << ';'; + out << nl << "if (" << stream << deref << func << cl->scoped() << "::__classIds[0], " << obj << "))"; + out << sb; + out << nl << param << " = " << cl->scoped() << "Ptr::dynamicCast(" << obj << ");"; + out << eb; + out << nl << "else"; + out << sb; + out << nl << param << " = new " << cl->scoped() << ';'; + out << nl << param << "->__" << func << stream << ");"; + out << eb; } else { - out << nl << "::Ice::ObjectPtr " << obj << ';'; + out << nl << stream << deref << func << "\"\"," << obj << ");"; + out << nl << param << " = " << cl->scoped() << "Ptr::dynamicCast(" << obj << ");"; } - out << nl << stream << deref << "read(" << obj << ", " << cl->scoped() << "::__classIds[0]);"; - out << nl << param << " = " << cl->scoped() << "Ptr::dynamicCast(" << obj << ");"; - out << nl << "if (!" << param << ')'; - out << sb; - out << nl << "throw ::Ice::ServantUnmarshalException(__FILE__, __LINE__);"; - out << eb; } out << eb; |