summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2005-09-08 07:26:18 +0000
committerMatthew Newhook <matthew@zeroc.com>2005-09-08 07:26:18 +0000
commit5b9b0d512c8d0ccc4c0e480b802fa841f38fd55c (patch)
treeda30228a4ed4468ee10db027590ba9a10a3e4e5d /cpp/src
parentfix build problem. (diff)
downloadice-5b9b0d512c8d0ccc4c0e480b802fa841f38fd55c.tar.bz2
ice-5b9b0d512c8d0ccc4c0e480b802fa841f38fd55c.tar.xz
ice-5b9b0d512c8d0ccc4c0e480b802fa841f38fd55c.zip
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=460
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Instance.cpp2
-rw-r--r--cpp/src/Ice/Instance.h2
-rw-r--r--cpp/src/Ice/Proxy.cpp26
-rw-r--r--cpp/src/Ice/Reference.cpp50
-rw-r--r--cpp/src/Ice/Reference.h2
5 files changed, 18 insertions, 64 deletions
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 3c6d9c3a42d..f5eec22f276 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -400,7 +400,7 @@ IceInternal::Instance::setDefaultContext(const Context& ctx)
_defaultContext = ctx;
}
-const Context&
+Context
IceInternal::Instance::getDefaultContext() const
{
IceUtil::RecMutex::Lock sync(*this);
diff --git a/cpp/src/Ice/Instance.h b/cpp/src/Ice/Instance.h
index 6f6dedef17a..44b50d98e95 100644
--- a/cpp/src/Ice/Instance.h
+++ b/cpp/src/Ice/Instance.h
@@ -76,7 +76,7 @@ public:
Ice::Int serverACM() const;
void flushBatchRequests();
void setDefaultContext(const ::Ice::Context&);
- const ::Ice::Context& getDefaultContext() const;
+ ::Ice::Context getDefaultContext() const;
private:
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp
index e9b70364262..11e8e6077dc 100644
--- a/cpp/src/Ice/Proxy.cpp
+++ b/cpp/src/Ice/Proxy.cpp
@@ -333,31 +333,17 @@ IceProxy::Ice::Object::ice_getContext() const
ObjectPrx
IceProxy::Ice::Object::ice_newContext(const Context& newContext) const
{
- if(_reference->hasContext() && newContext == _reference->getContext())
- {
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
- }
- else
- {
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeContext(newContext));
- return proxy;
- }
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeContext(newContext));
+ return proxy;
}
ObjectPrx
IceProxy::Ice::Object::ice_defaultContext() const
{
- if(!_reference->hasContext())
- {
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
- }
- else
- {
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->defaultContext());
- return proxy;
- }
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->defaultContext());
+ return proxy;
}
Identity
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp
index 383befc7907..6e89cb098b6 100644
--- a/cpp/src/Ice/Reference.cpp
+++ b/cpp/src/Ice/Reference.cpp
@@ -35,19 +35,14 @@ void IceInternal::decRef(IceInternal::Reference* p) { p->__decRef(); }
const Context&
IceInternal::Reference::getContext() const
{
- return _hasContext ? _context : _instance->getDefaultContext();
+ return _context;
}
ReferencePtr
IceInternal::Reference::defaultContext() const
{
- if(!_hasContext)
- {
- return ReferencePtr(const_cast<Reference*>(this));
- }
ReferencePtr r = _instance->referenceFactory()->copy(this);
- r->_hasContext = false;
- r->_context.clear();
+ r->_context = _instance->getDefaultContext();
return r;
}
@@ -60,12 +55,7 @@ IceInternal::Reference::getCommunicator() const
ReferencePtr
IceInternal::Reference::changeContext(const Context& newContext) const
{
- if(_hasContext && newContext == _context)
- {
- return ReferencePtr(const_cast<Reference*>(this));
- }
ReferencePtr r = _instance->referenceFactory()->copy(this);
- r->_hasContext = true;
r->_context = newContext;
return r;
}
@@ -111,8 +101,7 @@ IceInternal::Reference::changeDefault() const
{
ReferencePtr r = _instance->referenceFactory()->copy(this);
r->_mode = ModeTwoway;
- r->_hasContext = false;
- r->_context.clear();
+ r->_context = _instance->getDefaultContext();
r->_facet = "";
return r;
}
@@ -142,18 +131,15 @@ Reference::hash() const
h = 5 * h + *p;
}
- if(_hasContext)
+ for(q = _context.begin(); q != _context.end(); ++q)
{
- for(q = _context.begin(); q != _context.end(); ++q)
+ for(p = q->first.begin(); p != q->first.end(); ++p)
{
- 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;
- }
+ h = 5 * h + *p;
+ }
+ for(p = q->second.begin(); p != q->second.end(); ++p)
+ {
+ h = 5 * h + *p;
}
}
@@ -299,11 +285,6 @@ IceInternal::Reference::operator==(const Reference& r) const
return false;
}
- if(_hasContext != r._hasContext)
- {
- return false;
- }
-
if(_context != r._context)
{
return false;
@@ -348,15 +329,6 @@ IceInternal::Reference::operator<(const Reference& r) const
return false;
}
- if(_hasContext < r._hasContext)
- {
- return true;
- }
- else if(r._hasContext < _hasContext)
- {
- return false;
- }
-
if(_context < r._context)
{
return true;
@@ -406,7 +378,6 @@ IceInternal::Reference::Reference(const InstancePtr& inst, const CommunicatorPtr
_communicator(com),
_mode(md),
_identity(ident),
- _hasContext(!ctx.empty()),
_context(ctx),
_facet(fs),
_hashInitialized(false)
@@ -418,7 +389,6 @@ IceInternal::Reference::Reference(const Reference& r)
_communicator(r._communicator),
_mode(r._mode),
_identity(r._identity),
- _hasContext(r._hasContext),
_context(r._context),
_facet(r._facet),
_hashInitialized(false)
diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h
index 37441044bd4..d317a8828e6 100644
--- a/cpp/src/Ice/Reference.h
+++ b/cpp/src/Ice/Reference.h
@@ -64,7 +64,6 @@ public:
ReferencePtr changeContext(const Ice::Context&) const;
ReferencePtr changeMode(Mode) const;
ReferencePtr changeIdentity(const Ice::Identity&) const;
- bool hasContext() const { return _hasContext; }
ReferencePtr changeFacet(const std::string&) const;
//
@@ -115,7 +114,6 @@ private:
Mode _mode;
Ice::Identity _identity;
- bool _hasContext;
Ice::Context _context;
std::string _facet;