diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/BasicStream.cpp | 18 | ||||
-rw-r--r-- | cpp/src/Ice/StreamI.cpp | 10 | ||||
-rw-r--r-- | cpp/src/Ice/StreamI.h | 3 | ||||
-rw-r--r-- | cpp/src/Slice/CPlusPlusUtil.cpp | 24 |
4 files changed, 45 insertions, 10 deletions
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp index e2573e23e0e..67495714ba1 100644 --- a/cpp/src/Ice/BasicStream.cpp +++ b/cpp/src/Ice/BasicStream.cpp @@ -904,6 +904,12 @@ IceInternal::BasicStream::read(const char* signatureType, ObjectPtr& v) v = 0; return true; } + else if (id == "::Ice::Object") + { + v = new ::Ice::Object; + read(v); + return true; + } else { ObjectFactoryPtr factory = _instance->servantFactoryManager()->find(id); @@ -913,15 +919,13 @@ IceInternal::BasicStream::read(const char* signatureType, ObjectPtr& v) v = factory->create(id); if (v) { - _encapsStack.back().objectsRead.push_back(v); - v->__read(this); + read(v); return true; } } if (id == signatureType) { - _encapsStack.back().objectsRead.push_back(v); return false; } @@ -931,6 +935,14 @@ IceInternal::BasicStream::read(const char* signatureType, ObjectPtr& v) } void +IceInternal::BasicStream::read(const ObjectPtr& v) +{ + assert(v); + _encapsStack.back().objectsRead.push_back(v); + v->__read(this); +} + +void IceInternal::BasicStream::write(const UserException& v) { write(v.__getExceptionIds()[0]); diff --git a/cpp/src/Ice/StreamI.cpp b/cpp/src/Ice/StreamI.cpp index fcf0be736e8..0536c84f823 100644 --- a/cpp/src/Ice/StreamI.cpp +++ b/cpp/src/Ice/StreamI.cpp @@ -301,8 +301,14 @@ Ice::StreamI::writeObject(const ObjectPtr& value) _stream.write(value); } +bool +Ice::StreamI::readObject(const string& signatureType, ObjectPtr& value) +{ + return _stream.read(signatureType.c_str(), value); +} + void -Ice::StreamI::readObject(ObjectPtr& value) +Ice::StreamI::readObjectData(const ObjectPtr& value) { - _stream.read("", value); + _stream.read(value); } diff --git a/cpp/src/Ice/StreamI.h b/cpp/src/Ice/StreamI.h index 3a426e0f3da..b793821eed9 100644 --- a/cpp/src/Ice/StreamI.h +++ b/cpp/src/Ice/StreamI.h @@ -70,7 +70,8 @@ public: virtual void writeProxy(const ObjectPrx&); virtual void readProxy(ObjectPrx&); virtual void writeObject(const ObjectPtr&); - virtual void readObject(ObjectPtr&); + virtual bool readObject(const std::string&, ObjectPtr&); + virtual void readObjectData(const ObjectPtr&); private: diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 3ca1969af42..fd7652d5727 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -291,10 +291,25 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& string func = marshal ? "write(" : "read("; - if (BuiltinPtr::dynamicCast(type)) + BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); + if (builtin) { - out << nl << stream << deref << func << param << ");"; - return; + if (builtin->kind() == Builtin::KindObject) + { + if (marshal) + { + out << nl << stream << deref << func << param << ");"; + } + else + { + out << nl << stream << deref << func << "::Ice::Object::__classIds[0], " << param << ")"; + } + } + else + { + out << nl << stream << deref << func << param << ");"; + return; + } } ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type); @@ -319,7 +334,8 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& out << nl << "else"; out << sb; out << nl << param << " = new " << cl->scoped() << ';'; - out << nl << param << "->__" << func << stream << ");"; + out << nl << obj << " = " << param << ';'; + out << nl << stream << deref << func << obj << ");"; out << eb; } else |