diff options
author | Marc Laukien <marc@zeroc.com> | 2002-05-07 22:04:22 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-05-07 22:04:22 +0000 |
commit | 13e9139863f8f14722cf4c1ac8fb973af2a55a58 (patch) | |
tree | 5665fbb849e08f635fc6afc1ab0588c7ee473302 /cpp/src/Ice/Reference.cpp | |
parent | bug fix (diff) | |
download | ice-13e9139863f8f14722cf4c1ac8fb973af2a55a58.tar.bz2 ice-13e9139863f8f14722cf4c1ac8fb973af2a55a58.tar.xz ice-13e9139863f8f14722cf4c1ac8fb973af2a55a58.zip |
initial compression
Diffstat (limited to 'cpp/src/Ice/Reference.cpp')
-rw-r--r-- | cpp/src/Ice/Reference.cpp | 62 |
1 files changed, 48 insertions, 14 deletions
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index f416d1d39ca..5d454d063c0 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -53,6 +53,11 @@ IceInternal::Reference::operator==(const Reference& r) const return false; } + if (compress != r.compress) + { + return false; + } + if (origEndpoints != r.origEndpoints) { return false; @@ -126,6 +131,15 @@ IceInternal::Reference::operator<(const Reference& r) const return false; } + if (!compress && r.compress) + { + return true; + } + else if (r.compress < compress) + { + return false; + } + if (origEndpoints < r.origEndpoints) { return true; @@ -178,6 +192,8 @@ IceInternal::Reference::streamWrite(BasicStream* s) const s->write(static_cast<Byte>(mode)); s->write(secure); + + s->write(compress); vector<EndpointPtr>::const_iterator p; @@ -252,6 +268,11 @@ IceInternal::Reference::toString() const s << " -s"; } + if (compress) + { + s << " -s"; + } + vector<EndpointPtr>::const_iterator p; for (p = origEndpoints.begin(); p != origEndpoints.end(); ++p) @@ -280,7 +301,7 @@ IceInternal::Reference::changeIdentity(const Identity& newIdentity) const } else { - return instance->referenceFactory()->create(newIdentity, facet, mode, secure, + return instance->referenceFactory()->create(newIdentity, facet, mode, secure, compress, origEndpoints, endpoints, routerInfo, reverseAdapter); } @@ -295,7 +316,7 @@ IceInternal::Reference::changeFacet(const string& newFacet) const } else { - return instance->referenceFactory()->create(identity, newFacet, mode, secure, + return instance->referenceFactory()->create(identity, newFacet, mode, secure, compress, origEndpoints, endpoints, routerInfo, reverseAdapter); } @@ -341,7 +362,7 @@ IceInternal::Reference::changeTimeout(int timeout) const } } - return instance->referenceFactory()->create(identity, facet, mode, secure, + return instance->referenceFactory()->create(identity, facet, mode, secure, compress, newOrigEndpoints, newEndpoints, newRouterInfo, reverseAdapter); } @@ -355,7 +376,7 @@ IceInternal::Reference::changeMode(Mode newMode) const } else { - return instance->referenceFactory()->create(identity, facet, newMode, secure, + return instance->referenceFactory()->create(identity, facet, newMode, secure, compress, origEndpoints, endpoints, routerInfo, reverseAdapter); } @@ -370,7 +391,22 @@ IceInternal::Reference::changeSecure(bool newSecure) const } else { - return instance->referenceFactory()->create(identity, facet, mode, newSecure, + return instance->referenceFactory()->create(identity, facet, mode, newSecure, compress, + origEndpoints, endpoints, + routerInfo, reverseAdapter); + } +} + +ReferencePtr +IceInternal::Reference::changeCompress(bool newCompress) const +{ + if (newCompress == compress) + { + return ReferencePtr(const_cast<Reference*>(this)); + } + else + { + return instance->referenceFactory()->create(identity, facet, mode, secure, newCompress, origEndpoints, endpoints, routerInfo, reverseAdapter); } @@ -385,7 +421,7 @@ IceInternal::Reference::changeEndpoints(const vector<EndpointPtr>& newEndpoints) } else { - return instance->referenceFactory()->create(identity, facet, mode, secure, + return instance->referenceFactory()->create(identity, facet, mode, secure, compress, origEndpoints, newEndpoints, routerInfo, reverseAdapter); } @@ -402,7 +438,7 @@ IceInternal::Reference::changeRouter(const RouterPrx& newRouter) const } else { - return instance->referenceFactory()->create(identity, facet, mode, secure, + return instance->referenceFactory()->create(identity, facet, mode, secure, compress, origEndpoints, endpoints, newRouterInfo, reverseAdapter); } @@ -411,7 +447,7 @@ IceInternal::Reference::changeRouter(const RouterPrx& newRouter) const ReferencePtr IceInternal::Reference::changeDefault() const { - return instance->referenceFactory()->create(identity, "", ModeTwoway, false, + return instance->referenceFactory()->create(identity, "", ModeTwoway, false, false, origEndpoints, origEndpoints, 0, 0); } @@ -421,6 +457,7 @@ IceInternal::Reference::Reference(const InstancePtr& inst, const string& fac, Mode md, bool sec, + bool com, const vector<EndpointPtr>& origEndpts, const vector<EndpointPtr>& endpts, const RouterInfoPtr& rtrInfo, @@ -430,18 +467,13 @@ IceInternal::Reference::Reference(const InstancePtr& inst, facet(fac), mode(md), secure(sec), + compress(com), origEndpoints(origEndpts), endpoints(endpts), routerInfo(rtrInfo), reverseAdapter(rvAdapter), hashValue(0) { - calcHashValue(); -} - -void -IceInternal::Reference::calcHashValue() -{ Int h = 0; string::const_iterator p; @@ -465,6 +497,8 @@ IceInternal::Reference::calcHashValue() h = 5 * h + static_cast<Int>(secure); + h = 5 * h + static_cast<Int>(compress); + // // TODO: Should we also take the endpoints and other stuff into // account for hash calculation? Perhaps not, the code above |