diff options
author | Michi Henning <michi@zeroc.com> | 2003-08-27 08:59:34 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2003-08-27 08:59:34 +0000 |
commit | 3e55486ea753901101bed6974e872d0002c8aaed (patch) | |
tree | a615409a0cf6472a00162709cd007ff045b690c8 /cpp | |
parent | Added test for ice_getContext(). (diff) | |
download | ice-3e55486ea753901101bed6974e872d0002c8aaed.tar.bz2 ice-3e55486ea753901101bed6974e872d0002c8aaed.tar.xz ice-3e55486ea753901101bed6974e872d0002c8aaed.zip |
Added per-proxy contexts to icej. For ice, added context to operator== and
the hash function for proxies.
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Ice/Reference.cpp | 33 | ||||
-rw-r--r-- | cpp/src/slice2java/Gen.cpp | 4 | ||||
-rw-r--r-- | cpp/test/Ice/operations/Twoways.cpp | 4 |
3 files changed, 34 insertions, 7 deletions
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index 0f7da04d1c0..407a3f9524d 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -45,6 +45,11 @@ IceInternal::Reference::operator==(const Reference& r) const return false; } + if(context != r.context) + { + return false; + } + if(facet != r.facet) { return false; @@ -115,6 +120,15 @@ IceInternal::Reference::operator<(const Reference& r) const { return false; } + + if(context < r.context) + { + return true; + } + else if(r.context < context) + { + return false; + } if(facet < r.facet) { @@ -655,7 +669,8 @@ IceInternal::Reference::Reference(const InstancePtr& inst, Int h = 0; string::const_iterator p; - FacetPath::const_iterator q; + Context::const_iterator q; + FacetPath::const_iterator r; for(p = identity.name.begin(); p != identity.name.end(); ++p) { @@ -667,9 +682,21 @@ IceInternal::Reference::Reference(const InstancePtr& inst, h = 5 * h + *p; } - for(q = facet.begin(); q != facet.end(); ++q) + for(q = context.begin(); q != context.end(); ++q) + { + for(p = q->first.begin(); p != q->first.end(); ++p) + { + h = 5 * h + *p; + } + for(p = q->second.begin(); p != q->second.end(); ++p) + { + h = 5 * h + *p; + } + } + + for(r = facet.begin(); r != facet.end(); ++r) { - for(p = q->begin(); p != q->end(); ++p) + for(p = r->begin(); p != r->end(); ++p) { h = 5 * h + *p; } diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index ed3c4d1d497..6372c2b5a38 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -2371,7 +2371,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) { out << ", "; } - out << "null);"; + out << "__defaultContext());"; out << eb; out << sp; @@ -2436,7 +2436,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << sp; out << nl << "public void" << nl << opName << "_async(" << paramsAMI << ')'; out << sb; - out << nl << opName << "_async(" << argsAMI << ", null);"; + out << nl << opName << "_async(" << argsAMI << ", __defaultContext());"; out << eb; out << sp; diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp index aef5e5fbdf8..a937f19922b 100644 --- a/cpp/test/Ice/operations/Twoways.cpp +++ b/cpp/test/Ice/operations/Twoways.cpp @@ -598,13 +598,13 @@ twoways(const Test::MyClassPrx& p) ctx["two"] = "TWO"; ctx["three"] = "THREE"; { - test(p->ice_getContext().empty()); Test::StringStringD r = p->opContext(); + test(p->ice_getContext().empty()); test(r != ctx); } { - test(p->ice_getContext().empty()); Test::StringStringD r = p->opContext(ctx); + test(p->ice_getContext().empty()); test(r == ctx); } { |