summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/BasicStream.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2012-09-14 15:30:12 -0700
committerMark Spruiell <mes@zeroc.com>2012-09-14 15:30:12 -0700
commitc912d30d47799bbba77d0f2532704d8aaba12a4a (patch)
tree8611fdb0b73a9a78f7c319ca4bb08f1f9d2e9cd0 /cpp/src/Ice/BasicStream.cpp
parentFixed optional test issues (diff)
downloadice-c912d30d47799bbba77d0f2532704d8aaba12a4a.tar.bz2
ice-c912d30d47799bbba77d0f2532704d8aaba12a4a.tar.xz
ice-c912d30d47799bbba77d0f2532704d8aaba12a4a.zip
Python support for optionals
Diffstat (limited to 'cpp/src/Ice/BasicStream.cpp')
-rwxr-xr-xcpp/src/Ice/BasicStream.cpp39
1 files changed, 35 insertions, 4 deletions
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp
index 199ef69d639..105afb804bc 100755
--- a/cpp/src/Ice/BasicStream.cpp
+++ b/cpp/src/Ice/BasicStream.cpp
@@ -97,7 +97,8 @@ IceInternal::BasicStream::BasicStream(Instance* instance, const EncodingVersion&
_unlimited(unlimited),
_stringConverter(instance->initializationData().stringConverter),
_wstringConverter(instance->initializationData().wstringConverter),
- _startSeq(-1)
+ _startSeq(-1),
+ _sizePos(-1)
{
//
// Initialize the encoding members of our pre-allocated encapsulations, in case
@@ -126,6 +127,8 @@ IceInternal::BasicStream::clear()
_startSeq = -1;
+ _sizePos = -1;
+
_sliceObjects = true;
}
@@ -163,6 +166,7 @@ IceInternal::BasicStream::swap(BasicStream& other)
std::swap(_unlimited, other._unlimited);
std::swap(_startSeq, other._startSeq);
std::swap(_minSeqSize, other._minSeqSize);
+ std::swap(_sizePos, other._sizePos);
}
void
@@ -2754,12 +2758,39 @@ IceInternal::BasicStream::EncapsDecoder::readInstance()
skipSlice();
//
- // If this is the last slice, keep the object as an opaque
- // UnknownSlicedData object.
+ // If this is the last slice, keep the object as an opaque UnknownSlicedObject.
//
if(_sliceFlags & FLAG_IS_LAST_SLICE)
{
- v = new UnknownSlicedObject(mostDerivedId);
+ //
+ // Provide a factory with an opportunity to supply the object.
+ // We pass the "::Ice::Object" ID to indicate that this is the
+ // last chance to preserve the object.
+ //
+ userFactory = servantFactoryManager->find(Object::ice_staticId());
+ if(userFactory)
+ {
+ v = userFactory->create(Object::ice_staticId());
+ }
+
+ //
+ // If that fails, invoke the default factory if one has been
+ // registered.
+ //
+ if(!v)
+ {
+ userFactory = servantFactoryManager->find("");
+ if(userFactory)
+ {
+ v = userFactory->create(Object::ice_staticId());
+ }
+ }
+
+ if(!v)
+ {
+ v = new UnknownSlicedObject(mostDerivedId);
+ }
+
break;
}