summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/BasicStream.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2002-01-23 16:22:43 +0000
committerMatthew Newhook <matthew@zeroc.com>2002-01-23 16:22:43 +0000
commit48b22912b2d0b30ed6a4bf3b175801c57f12525b (patch)
tree0ce25e038871c5f8607794af01b16aa2095175bf /cpp/src/Ice/BasicStream.cpp
parentfixes (diff)
downloadice-48b22912b2d0b30ed6a4bf3b175801c57f12525b.tar.bz2
ice-48b22912b2d0b30ed6a4bf3b175801c57f12525b.tar.xz
ice-48b22912b2d0b30ed6a4bf3b175801c57f12525b.zip
Initial commit of generic marshaling.
Diffstat (limited to 'cpp/src/Ice/BasicStream.cpp')
-rw-r--r--cpp/src/Ice/BasicStream.cpp47
1 files changed, 16 insertions, 31 deletions
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp
index 9d2bc9bf314..9f80344fe1d 100644
--- a/cpp/src/Ice/BasicStream.cpp
+++ b/cpp/src/Ice/BasicStream.cpp
@@ -816,8 +816,8 @@ IceInternal::BasicStream::write(const ObjectPtr& v)
}
}
-bool
-IceInternal::BasicStream::read(const string& signatureType, ObjectPtr& v)
+void
+IceInternal::BasicStream::read(const string& signatureType, const ObjectFactoryPtr& factory, ObjectPtr& v)
{
if (!_currentReadEncaps) // Lazy initialization
{
@@ -835,7 +835,6 @@ IceInternal::BasicStream::read(const string& signatureType, ObjectPtr& v)
throw IllegalIndirectionException(__FILE__, __LINE__);
}
v = _currentReadEncaps->objectsRead[pos];
- return true;
}
else
{
@@ -846,52 +845,38 @@ IceInternal::BasicStream::read(const string& signatureType, ObjectPtr& v)
if (id.empty())
{
v = 0;
- return true;
+ return;
}
else if (id == iceObject)
{
v = new ::Ice::Object;
- read(v);
- return true;
}
else
{
- ObjectFactoryPtr factory = _instance->servantFactoryManager()->find(id);
-
- if (factory)
+ ObjectFactoryPtr userFactory = _instance->servantFactoryManager()->find(id);
+ if (userFactory)
+ {
+ v = userFactory->create(id);
+ }
+
+ if (!v && id == signatureType)
{
+ assert(factory);
v = factory->create(id);
- if (v)
- {
- read(v);
- return true;
- }
+ assert(v);
}
- if (id == signatureType)
+ if (!v)
{
- return false;
+ throw NoObjectFactoryException(__FILE__, __LINE__);
}
-
- throw NoObjectFactoryException(__FILE__, __LINE__);
}
+ _currentReadEncaps->objectsRead.push_back(v.get());
+ v->__read(this);
}
}
void
-IceInternal::BasicStream::read(const ObjectPtr& v)
-{
- assert(v);
- if (!_currentReadEncaps) // Lazy initialization
- {
- _readEncapsStack.resize(1);
- _currentReadEncaps = &_readEncapsStack.back();
- }
- _currentReadEncaps->objectsRead.push_back(v.get());
- v->__read(this);
-}
-
-void
IceInternal::BasicStream::write(const UserException& v)
{
write(v.__getExceptionIds()[0]);