From 2b9b49404388c8d395e4ee3da6a9d182438f2fff Mon Sep 17 00:00:00 2001 From: mzn Date: Thu, 15 Feb 2007 09:40:52 +0000 Subject: [PATCH] Fix for bug NPAL14900(Pb of performances with FindObjectIOR). --- src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx | 43 ++++++------------------- 1 file changed, 9 insertions(+), 34 deletions(-) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index f6c2fa1f6..e34aa990a 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -343,44 +343,19 @@ Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindObjectByName(const Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectIOR(const TCollection_AsciiString& anObjectIOR) { _errorCode = ""; - - // firstly searching in the datamap for optimization + + Handle(SALOMEDSImpl_SObject) aResult = NULL; + + // searching in the datamap for optimization if (myIORLabels.IsBound(anObjectIOR)) { - Handle(SALOMEDSImpl_SObject) aResult = GetSObject(myIORLabels.Find(anObjectIOR)); + aResult = GetSObject(myIORLabels.Find(anObjectIOR)); // 11 oct 2002: forbidden attributes must be checked here - if (!aResult->GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID())) { + if (!aResult->GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID())) myIORLabels.UnBind(anObjectIOR); - } else - return aResult; - } - // Iterate to all components defined in the study - // After testing the component name, iterate in all objects defined under - // components (function _FindObject) - bool _find = false; - Handle(SALOMEDSImpl_SObject) RefSO = NULL; - - SALOMEDSImpl_SComponentIterator it = NewComponentIterator(); - Handle(SALOMEDSImpl_SComponent) SC; - for (; it.More();it.Next()){ - if(!_find) - { - SC = it.Value(); - TCollection_AsciiString ior = SC->GetIOR(); - if (ior != "") - { - if (ior == anObjectIOR) - { - _find = true; - RefSO = SC; - } - } - if (!_find) - RefSO = _FindObjectIOR(SC, anObjectIOR, _find); - } } - - if(RefSO.IsNull()) _errorCode = "No object was found"; - return RefSO; + + if(aResult.IsNull()) _errorCode = "No object was found"; + return aResult; } //============================================================================ -- 2.39.2