summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/include/Ice/Handle.h6
-rw-r--r--cpp/include/Ice/ProxyHandle.h6
-rw-r--r--cpp/include/IceUtil/Handle.h6
-rw-r--r--cpp/src/Ice/ProxyFactory.cpp11
-rw-r--r--cpp/src/Ice/Reference.cpp13
-rw-r--r--cpp/src/Ice/Reference.h2
-rw-r--r--cpp/test/Ice/inheritance/AllTests.cpp3
-rw-r--r--cpp/test/Ice/operations/TestI.cpp3
-rw-r--r--cpp/test/Ice/operations/Twoways.cpp33
9 files changed, 49 insertions, 34 deletions
diff --git a/cpp/include/Ice/Handle.h b/cpp/include/Ice/Handle.h
index 71bf7dbae4e..c64307fac63 100644
--- a/cpp/include/Ice/Handle.h
+++ b/cpp/include/Ice/Handle.h
@@ -190,6 +190,12 @@ inline bool operator==(const Handle<T>& a, const Handle<U>& b)
}
template<typename T, typename U>
+inline bool operator!=(const Handle<T>& a, const Handle<U>& b)
+{
+ return !operator==(a, b);
+}
+
+template<typename T, typename U>
inline bool operator<(const Handle<T>& a, const Handle<U>& b)
{
T* ap = a.get();
diff --git a/cpp/include/Ice/ProxyHandle.h b/cpp/include/Ice/ProxyHandle.h
index 5a9d0069bef..a70e33f5bef 100644
--- a/cpp/include/Ice/ProxyHandle.h
+++ b/cpp/include/Ice/ProxyHandle.h
@@ -166,6 +166,12 @@ inline bool operator==(const ProxyHandle<T>& a, const ProxyHandle<U>& b)
}
template<typename T, typename U>
+inline bool operator!=(const ProxyHandle<T>& a, const ProxyHandle<U>& b)
+{
+ return !operator==(a, b);
+}
+
+template<typename T, typename U>
inline bool operator<(const ProxyHandle<T>& a, const ProxyHandle<U>& b)
{
T* ap = a.get();
diff --git a/cpp/include/IceUtil/Handle.h b/cpp/include/IceUtil/Handle.h
index 272cc5baef3..2c5a40351ef 100644
--- a/cpp/include/IceUtil/Handle.h
+++ b/cpp/include/IceUtil/Handle.h
@@ -182,6 +182,12 @@ inline bool operator==(const Handle<T>& a, const Handle<U>& b)
}
template<typename T, typename U>
+inline bool operator!=(const Handle<T>& a, const Handle<U>& b)
+{
+ return !operator==(a, b);
+}
+
+template<typename T, typename U>
inline bool operator<(const Handle<T>& a, const Handle<U>& b)
{
T* ap = a.get();
diff --git a/cpp/src/Ice/ProxyFactory.cpp b/cpp/src/Ice/ProxyFactory.cpp
index eacfce7e27c..10cfc0dcba6 100644
--- a/cpp/src/Ice/ProxyFactory.cpp
+++ b/cpp/src/Ice/ProxyFactory.cpp
@@ -38,18 +38,16 @@ IceInternal::ProxyFactory::proxyToString(const ObjectPrx& proxy)
ObjectPrx
IceInternal::ProxyFactory::streamToProxy(Stream* s)
{
- Stream::Container::iterator i = s->i;
string identity;
s->read(identity);
- if (identity.length() == 0)
+ if (identity.length())
{
- return 0;
+ ReferencePtr reference = new Reference(identity, s);
+ return referenceToProxy(reference);
}
else
{
- s->i = i;
- ReferencePtr reference = new Reference(s);
- return referenceToProxy(reference);
+ return 0;
}
}
@@ -66,6 +64,7 @@ IceInternal::ProxyFactory::proxyToStream(const ObjectPrx& proxy, Stream* s)
{
if (proxy)
{
+ s->write(proxy->__reference()->identity);
proxy->__reference()->streamWrite(s);
}
else
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp
index 349a5794bb1..8b6d86fe3ce 100644
--- a/cpp/src/Ice/Reference.cpp
+++ b/cpp/src/Ice/Reference.cpp
@@ -180,12 +180,16 @@ IceInternal::Reference::Reference(const InstancePtr& inst, const string& str) :
}
}
-IceInternal::Reference::Reference(Stream* s) :
+IceInternal::Reference::Reference(const string& ident, Stream* s) :
instance(s->instance()),
+ identity(ident),
mode(ModeTwoway),
secure(false)
{
- s->read(const_cast<string&>(identity));
+ //
+ // Don't read the identity here. Operations calling this
+ // constructor read the identity, and pass it as a parameter.
+ //
vector<EndpointPtr>::const_iterator p;
Ice::Int sz;
@@ -217,7 +221,10 @@ IceInternal::Reference::Reference(Stream* s) :
void
IceInternal::Reference::streamWrite(Stream* s) const
{
- s->write(identity);
+ //
+ // Don't write the identity here. Operations calling streamWrite
+ // write the identity.
+ //
vector<EndpointPtr>::const_iterator p;
diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h
index 76c9a375546..0fbcd966063 100644
--- a/cpp/src/Ice/Reference.h
+++ b/cpp/src/Ice/Reference.h
@@ -37,7 +37,7 @@ public:
Reference(const InstancePtr&, const std::string&, Mode, bool,
const std::vector<EndpointPtr>&, const std::vector<EndpointPtr>&);
Reference(const InstancePtr&, const std::string&);
- Reference(Stream*);
+ Reference(const std::string&, Stream*);
//
// Marshal the reference
diff --git a/cpp/test/Ice/inheritance/AllTests.cpp b/cpp/test/Ice/inheritance/AllTests.cpp
index 28abf4687a6..5b29aa4d83f 100644
--- a/cpp/test/Ice/inheritance/AllTests.cpp
+++ b/cpp/test/Ice/inheritance/AllTests.cpp
@@ -34,9 +34,6 @@ allTests(Ice::CommunicatorPtr communicator)
M_B::C_BPrx cb = initial->c_b();
M_A::C_CPrx cc = initial->c_c();
M_A::C_DPrx cd = initial->c_d();
- cout << ca->_getIdentity() << ", " << cb->_getIdentity() << endl;
- cout << ca->_getIdentity() << ", " << cc->_getIdentity() << endl;
- cout << ca->_getIdentity() << ", " << cd->_getIdentity() << endl;
test(ca != cb);
test(ca != cc);
test(ca != cd);
diff --git a/cpp/test/Ice/operations/TestI.cpp b/cpp/test/Ice/operations/TestI.cpp
index d4112f6ed73..65256ee55e0 100644
--- a/cpp/test/Ice/operations/TestI.cpp
+++ b/cpp/test/Ice/operations/TestI.cpp
@@ -316,10 +316,13 @@ MyDerivedClassI::opWStringMyEnumD(const Test::WStringMyEnumD& p1, const Test::WS
return r;
}
+using namespace std;
+
Test::MyClassStringD
MyDerivedClassI::opMyClassStringD(const Test::MyClassStringD& p1, const Test::MyClassStringD& p2,
Test::MyClassStringD& p3)
{
+ Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(_adapter->objectToProxy(this));
p3 = p1;
Test::MyClassStringD r;
std::set_union(p1.begin(), p1.end(), p2.begin(), p2.end(), std::inserter(r, r.end()));
diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp
index e3349c238ec..8d26b5494cf 100644
--- a/cpp/test/Ice/operations/Twoways.cpp
+++ b/cpp/test/Ice/operations/Twoways.cpp
@@ -515,22 +515,22 @@ twoways(Test::MyClassPrx p)
{
Test::LongFloatD di1;
- di1[999999110] = -1.1;
- di1[9999991100] = 123123.2;
+ di1[999999110] = Ice::Float(-1.1);
+ di1[9999991100] = Ice::Float(123123.2);
Test::LongFloatD di2;
- di2[999999110] = -1.1;
- di2[999999111] = -100.4;
- di2[9999991101] = 0.5;
+ di2[999999110] = Ice::Float(-1.1);
+ di2[999999111] = Ice::Float(-100.4);
+ di2[9999991101] = Ice::Float(0.5);
Test::LongFloatD _do;
Test::LongFloatD ro = p->opLongFloatD(di1, di2, _do);
test(_do == di1);
test(ro.size() == 4);
- test(ro[999999110] == di1[999999110]);
- test(ro[999999111] == di2[999999111]);
- test(ro[9999991100] == di1[9999991100]);
- test(ro[9999991101] == di2[9999991101]);
+ test(ro[999999110] == Ice::Float(-1.1));
+ test(ro[999999111] == Ice::Float(-100.4));
+ test(ro[9999991100] == Ice::Float(123123.2));
+ test(ro[9999991101] == Ice::Float(0.5));
}
{
@@ -575,28 +575,19 @@ twoways(Test::MyClassPrx p)
{
Test::MyClassStringD di1;
- cout << 1 << endl;
di1[p] = "abc";
- cout << 2 << endl;
di1[0] = "def";
- cout << 3 << endl;
Test::MyClassStringD di2;
di2[p] = "abc";
- cout << 4 << endl;
Test::MyClassStringD _do;
Test::MyClassStringD ro = p->opMyClassStringD(di1, di2, _do);
- cout << 5 << endl;
test(_do == di1);
- cout << 6 << endl;
test(ro.size() == 2);
- cout << 7 << endl;
test(ro[p] == "abc");
- cout << 8 << endl;
test(ro[0] == "def");
- cout << 9 << endl;
int i = 0;
for (Test::MyClassStringD::iterator q = ro.begin(); q != ro.end(); ++q, ++i)
{
@@ -604,12 +595,12 @@ twoways(Test::MyClassPrx p)
if (i == 0)
{
- test(q->first);
- q->first->opVoid();
+ test(!q->first);
}
else
{
- test(!q->first);
+ test(q->first);
+ q->first->opVoid();
}
}
}