summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Reference.cpp
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/Ice/Reference.cpp
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/Ice/Reference.cpp')
-rw-r--r--cpp/src/Ice/Reference.cpp50
1 files changed, 10 insertions, 40 deletions
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)