summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/BasicStream.cpp63
-rw-r--r--cpp/src/Ice/Reference.cpp212
-rw-r--r--cpp/src/Ice/Reference.h6
3 files changed, 150 insertions, 131 deletions
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp
index ad1ce577113..ebeb1c685bf 100644
--- a/cpp/src/Ice/BasicStream.cpp
+++ b/cpp/src/Ice/BasicStream.cpp
@@ -617,11 +617,11 @@ IceInternal::BasicStream::write(const string& v)
write(len);
if (len > 0)
{
+ Int num = _encapsStack.back().stringsWritten.size();
+ _encapsStack.back().stringsWritten[v] = -(num + 1);
int pos = b.size();
resize(pos + len);
copy(v.begin(), v.end(), b.begin() + pos);
- Int num = _encapsStack.back().stringsWritten.size();
- _encapsStack.back().stringsWritten[v] = -(num + 1);
}
}
}
@@ -710,13 +710,13 @@ IceInternal::BasicStream::write(const wstring& v)
write(len);
if (len > 0)
{
+ Int num = _encapsStack.back().wstringsWritten.size();
+ _encapsStack.back().wstringsWritten[v] = -(num + 1);
wstring::const_iterator p;
for (p = v.begin(); p != v.end(); ++p)
{
write(static_cast<Short>(*p));
}
- Int num = _encapsStack.back().wstringsWritten.size();
- _encapsStack.back().wstringsWritten[v] = -(num + 1);
}
}
}
@@ -809,10 +809,18 @@ IceInternal::BasicStream::write(const ObjectPtr& v)
else
{
write(Int(-1));
- write(v->__getClassIds()[0]);
- v->__write(this);
- Int num = _encapsStack.back().objectsWritten.size();
- _encapsStack.back().objectsWritten[v] = num;
+
+ if (v)
+ {
+ Int num = _encapsStack.back().objectsWritten.size();
+ _encapsStack.back().objectsWritten[v] = num;
+ write(v->__getClassIds()[0]);
+ v->__write(this);
+ }
+ else
+ {
+ write("");
+ }
}
}
@@ -835,24 +843,35 @@ IceInternal::BasicStream::read(const char* signatureType, ObjectPtr& v)
{
string id;
read(id);
- ObjectFactoryPtr factory = _instance->servantFactoryManager()->find(id);
-
- if (factory)
+
+ if (id.empty())
{
- v = factory->create(id);
- if (v)
- {
- v->__read(this);
- return true;
- }
+ v = 0;
+ return true;
}
-
- if (id == signatureType)
+ else
{
- return false;
+ ObjectFactoryPtr factory = _instance->servantFactoryManager()->find(id);
+
+ if (factory)
+ {
+ v = factory->create(id);
+ if (v)
+ {
+ _encapsStack.back().objectsRead.push_back(v);
+ v->__read(this);
+ return true;
+ }
+ }
+
+ if (id == signatureType)
+ {
+ _encapsStack.back().objectsRead.push_back(v);
+ return false;
+ }
+
+ throw NoObjectFactoryException(__FILE__, __LINE__);
}
-
- throw NoObjectFactoryException(__FILE__, __LINE__);
}
}
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp
index 172ff995567..8cc024bb607 100644
--- a/cpp/src/Ice/Reference.cpp
+++ b/cpp/src/Ice/Reference.cpp
@@ -299,6 +299,112 @@ IceInternal::Reference::Reference(const string& ident, BasicStream* s) :
calcHashValue();
}
+bool
+IceInternal::Reference::operator==(const Reference& r) const
+{
+ if (this == &r)
+ {
+ return true;
+ }
+
+ if (identity != r.identity)
+ {
+ return false;
+ }
+
+ if (facet != r.facet)
+ {
+ return false;
+ }
+
+ if (mode != r.mode)
+ {
+ return false;
+ }
+
+ if (secure != r.secure)
+ {
+ return false;
+ }
+
+ if (origEndpoints != r.origEndpoints)
+ {
+ return false;
+ }
+
+ if (endpoints != r.endpoints)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool
+IceInternal::Reference::operator<(const Reference& r) const
+{
+ if (this == &r)
+ {
+ return false;
+ }
+
+ if (identity < r.identity)
+ {
+ return true;
+ }
+ else if (identity != r.identity)
+ {
+ return false;
+ }
+
+ if (facet < r.facet)
+ {
+ return true;
+ }
+ else if (facet != r.facet)
+ {
+ return false;
+ }
+
+ if (mode < r.mode)
+ {
+ return true;
+ }
+ else if (mode != r.mode)
+ {
+ return false;
+ }
+
+ if (!secure && r.secure)
+ {
+ return true;
+ }
+ else if (secure != r.secure)
+ {
+ return false;
+ }
+
+ if (origEndpoints < r.origEndpoints)
+ {
+ return true;
+ }
+ else if (origEndpoints != r.origEndpoints)
+ {
+ return false;
+ }
+
+ if (endpoints < r.endpoints)
+ {
+ return true;
+ }
+ else if (endpoints != r.endpoints)
+ {
+ return false;
+ }
+
+ return false;
+}
+
void
IceInternal::Reference::streamWrite(BasicStream* s) const
{
@@ -453,112 +559,6 @@ IceInternal::Reference::changeEndpoints(const std::vector<EndpointPtr>& newEndpo
}
}
-bool
-IceInternal::Reference::operator==(const Reference& r) const
-{
- if (this == &r)
- {
- return true;
- }
-
- if (identity != r.identity)
- {
- return false;
- }
-
- if (facet != r.facet)
- {
- return false;
- }
-
- if (mode != r.mode)
- {
- return false;
- }
-
- if (secure != r.secure)
- {
- return false;
- }
-
- if (origEndpoints != r.origEndpoints)
- {
- return false;
- }
-
- if (endpoints != r.endpoints)
- {
- return false;
- }
-
- return true;
-}
-
-bool
-IceInternal::Reference::operator<(const Reference& r) const
-{
- if (this == &r)
- {
- return false;
- }
-
- if (identity < r.identity)
- {
- return true;
- }
- else if (identity != r.identity)
- {
- return false;
- }
-
- if (facet < r.facet)
- {
- return true;
- }
- else if (facet != r.facet)
- {
- return false;
- }
-
- if (mode < r.mode)
- {
- return true;
- }
- else if (mode != r.mode)
- {
- return false;
- }
-
- if (!secure && r.secure)
- {
- return true;
- }
- else if (secure != r.secure)
- {
- return false;
- }
-
- if (origEndpoints < r.origEndpoints)
- {
- return true;
- }
- else if (origEndpoints != r.origEndpoints)
- {
- return false;
- }
-
- if (endpoints < r.endpoints)
- {
- return true;
- }
- else if (endpoints != r.endpoints)
- {
- return false;
- }
-
- return false;
-}
-
void
IceInternal::Reference::calcHashValue()
{
diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h
index f6f1cc1a3e0..f60ae3171b5 100644
--- a/cpp/src/Ice/Reference.h
+++ b/cpp/src/Ice/Reference.h
@@ -40,6 +40,9 @@ public:
Reference(const InstancePtr&, const std::string&);
Reference(const std::string&, BasicStream*);
+ bool operator==(const Reference&) const;
+ bool operator<(const Reference&) const;
+
//
// Marshal the reference
//
@@ -73,9 +76,6 @@ public:
ReferencePtr changeSecure(bool) const;
ReferencePtr changeEndpoints(const std::vector<EndpointPtr>&) const;
- bool operator==(const Reference&) const;
- bool operator<(const Reference&) const;
-
private:
void calcHashValue();