summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Ice/Object.cpp')
-rw-r--r--cpp/src/Ice/Object.cpp64
1 files changed, 39 insertions, 25 deletions
diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp
index c64a503760a..72e40db2a72 100644
--- a/cpp/src/Ice/Object.cpp
+++ b/cpp/src/Ice/Object.cpp
@@ -343,7 +343,38 @@ Ice::Object::ice_removeAllFacets()
}
ObjectPtr
-Ice::Object::ice_findFacet(const vector<string>& path, int start)
+Ice::Object::ice_findFacet(const string& name)
+{
+ IceUtil::Mutex::Lock sync(_activeFacetMapMutex);
+
+ map<string, ObjectPtr>::iterator p = _activeFacetMap.end();
+
+ if(_activeFacetMapHint != _activeFacetMap.end())
+ {
+ if(_activeFacetMapHint->first == name)
+ {
+ p = _activeFacetMapHint;
+ }
+ }
+
+ if(p == _activeFacetMap.end())
+ {
+ p = _activeFacetMap.find(name);
+ }
+
+ if(p != _activeFacetMap.end())
+ {
+ _activeFacetMapHint = p;
+ return p->second;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+ObjectPtr
+Ice::Object::ice_findFacetPath(const vector<string>& path, int start)
{
int sz = path.size();
@@ -357,32 +388,15 @@ Ice::Object::ice_findFacet(const vector<string>& path, int start)
return this;
}
+ ObjectPtr f = ice_findFacet(path[start]);
+ if(f)
{
- IceUtil::Mutex::Lock sync(_activeFacetMapMutex);
-
- map<string, ObjectPtr>::iterator p = _activeFacetMap.end();
-
- if(_activeFacetMapHint != _activeFacetMap.end())
- {
- if(_activeFacetMapHint->first == path[start])
- {
- p = _activeFacetMapHint;
- }
- }
-
- if(p == _activeFacetMap.end())
- {
- p = _activeFacetMap.find(path[start]);
- }
-
- if(p != _activeFacetMap.end())
- {
- _activeFacetMapHint = p;
- return p->second->ice_findFacet(path, start + 1);
- }
+ return f->ice_findFacetPath(path, start + 1);
+ }
+ else
+ {
+ return f;
}
-
- return 0;
}
DispatchStatus