From 153b9f8024c791e7ca444c0e21e50177d28898e7 Mon Sep 17 00:00:00 2001 From: srn Date: Wed, 13 Dec 2006 11:46:11 +0000 Subject: [PATCH] Fixed bugs in the corresponding classes that caused error in Unittests --- .../SALOMEDSImpl_AttributeParameter.cxx | 31 ++++++++++++++----- src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx | 24 ++++++++++++-- src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx | 6 +++- 3 files changed, 50 insertions(+), 11 deletions(-) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx index 1eea12dbd..820643d35 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx @@ -119,6 +119,8 @@ void SALOMEDSImpl_AttributeParameter::SetInt(const string& theID, const int& the { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _ints[theID] = theValue; @@ -148,6 +150,8 @@ void SALOMEDSImpl_AttributeParameter::SetReal(const string& theID, const double& { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _reals[theID] = theValue; @@ -177,6 +181,8 @@ void SALOMEDSImpl_AttributeParameter::SetString(const string& theID, const strin { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _strings[theID] = theValue; @@ -206,6 +212,8 @@ void SALOMEDSImpl_AttributeParameter::SetBool(const string& theID, const bool& t { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _bools[theID] = theValue; @@ -235,6 +243,8 @@ void SALOMEDSImpl_AttributeParameter::SetRealArray(const string& theID, const ve { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _realarrays[theID] = theArray; @@ -265,6 +275,8 @@ void SALOMEDSImpl_AttributeParameter::SetIntArray(const string& theID, const vec { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _intarrays[theID] = theArray; @@ -295,6 +307,8 @@ void SALOMEDSImpl_AttributeParameter::SetStrArray(const string& theID, const vec { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _strarrays[theID] = theArray; @@ -583,17 +597,20 @@ void SALOMEDSImpl_AttributeParameter::Restore(const Handle(TDF_Attribute)& with) _intarrays.clear(); _strarrays.clear(); - for(map::const_iterator p = A->_ints.begin(); p!= A->_ints.end(); p++) _ints[p->first] = p->second; - for(map::const_iterator p = A->_reals.begin(); p!= A->_reals.end(); p++) _reals[p->first] = p->second; - for(map::const_iterator p = A->_bools.begin(); p!= A->_bools.end(); p++) _bools[p->first] = p->second; + for(map::const_iterator p = A->_ints.begin(); p!= A->_ints.end(); p++) + if(p->first.size()) _ints[p->first] = p->second; + for(map::const_iterator p = A->_reals.begin(); p!= A->_reals.end(); p++) + if(p->first.size()) _reals[p->first] = p->second; + for(map::const_iterator p = A->_bools.begin(); p!= A->_bools.end(); p++) + if(p->first.size()) _bools[p->first] = p->second; for(map::const_iterator p = A->_strings.begin(); p!= A->_strings.end(); p++) - _strings[p->first] = p->second; + if(p->first.size()) _strings[p->first] = p->second; for(map< string,vector >::const_iterator p = A->_realarrays.begin(); p!= A->_realarrays.end(); p++) - _realarrays[p->first] = p->second; + if(p->first.size()) _realarrays[p->first] = p->second; for(map< string,vector >::const_iterator p = A->_intarrays.begin(); p!= A->_intarrays.end(); p++) - _intarrays[p->first] = p->second; + if(p->first.size()) _intarrays[p->first] = p->second; for(map< string,vector >::const_iterator p = A->_strarrays.begin(); p!= A->_strarrays.end(); p++) - _strarrays[p->first] = p->second; + if(p->first.size()) _strarrays[p->first] = p->second; } //======================================================================= diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index 63b5c2c3a..28f8a0ff2 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -590,7 +590,7 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetObjectNames(const return aResultSeq; } - TDF_ChildIterator anIter (aLabel, Standard_False); // iterate all subchildren at all sublevels + TDF_ChildIterator anIter (aLabel, Standard_True); // iterate all subchildren at all sublevels for (; anIter.More(); anIter.Next()) { TDF_Label aLabel = anIter.Value(); Handle(SALOMEDSImpl_AttributeName) aName; @@ -624,7 +624,7 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetDirectoryNames(con return aResultSeq; } - TDF_ChildIterator anIter (aLabel, Standard_False); // iterate first-level children at all sublevels + TDF_ChildIterator anIter (aLabel, Standard_True); // iterate first-level children at all sublevels for (; anIter.More(); anIter.Next()) { TDF_Label aLabel = anIter.Value(); Handle(SALOMEDSImpl_AttributeLocalID) anID; @@ -665,7 +665,7 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetFileNames(const TC return aResultSeq; } - TDF_ChildIterator anIter (aLabel, Standard_False); // iterate all subchildren at all sublevels + TDF_ChildIterator anIter (aLabel, Standard_True); // iterate all subchildren at all sublevels for (; anIter.More(); anIter.Next()) { TDF_Label aLabel = anIter.Value(); Handle(SALOMEDSImpl_AttributeLocalID) anID; @@ -1635,3 +1635,21 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetLockerID() { return _lockers; } + +//============================================================================ +/*! Function : EnableUseCaseAutoFilling + * Purpose : + */ +//============================================================================ +void SALOMEDSImpl_Study::EnableUseCaseAutoFilling(bool isEnabled) +{ + _errorCode = ""; _autoFill = isEnabled; + if(isEnabled) { + _builder->SetOnAddSObject(_cb); + _builder->SetOnRemoveSObject(_cb); + } + else { + _builder->SetOnAddSObject(NULL); + _builder->SetOnRemoveSObject(NULL); + } +} \ No newline at end of file diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx index 3aac4acb4..2ee5246f7 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx @@ -229,7 +229,7 @@ public: Standard_EXPORT virtual void Close(); - Standard_EXPORT void EnableUseCaseAutoFilling(bool isEnabled) { _errorCode = ""; _autoFill = isEnabled; } + Standard_EXPORT void EnableUseCaseAutoFilling(bool isEnabled); // postponed destroying of object functionality Standard_EXPORT virtual void AddPostponed(const TCollection_AsciiString& theIOR); @@ -288,6 +288,10 @@ public: //Returns an ID of the study locker Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) GetLockerID(); + //Returns a callback + Standard_EXPORT Handle(SALOMEDSImpl_Callback) GetCallback() { return _cb; } + + public: DEFINE_STANDARD_RTTI( SALOMEDSImpl_Study ) -- 2.39.2