From 70b4d500b3641818707723dfb91654938a176f64 Mon Sep 17 00:00:00 2001 From: srn Date: Fri, 29 Jan 2010 07:10:47 +0000 Subject: [PATCH] Added storing of modification deltas to enable optimization of the Object Browser --- idl/SALOMEDS.idl | 22 +++ src/SALOMEDS/SALOMEDS_Study.cxx | 157 +++++++++++------- src/SALOMEDS/SALOMEDS_Study.hxx | 3 + src/SALOMEDS/SALOMEDS_Study_i.cxx | 37 +++++ src/SALOMEDS/SALOMEDS_Study_i.hxx | 4 + src/SALOMEDSClient/SALOMEDSClient_Study.hxx | 3 + .../SALOMEDSClient_definitions.hxx | 21 +++ src/SALOMEDSImpl/Makefile.am | 1 + .../SALOMEDSImpl_GenericAttribute.cxx | 5 + src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx | 42 ++++- src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx | 3 + src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx | 86 ++++++++++ src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx | 24 ++- .../SALOMEDSImpl_StudyBuilder.cxx | 16 +- src/SALOMEDSImpl/Test/Makefile.am | 1 + 15 files changed, 359 insertions(+), 66 deletions(-) diff --git a/idl/SALOMEDS.idl b/idl/SALOMEDS.idl index 4325a3875..6aaea74b3 100644 --- a/idl/SALOMEDS.idl +++ b/idl/SALOMEDS.idl @@ -99,6 +99,18 @@ during each working session. //! Exception indicating that this feature hasn't been implemented in %SALOME application. exception NotImplemented {}; +//! Enumeration that describes modifications of the %Study + enum DeltaType { DT_NONE, DT_ADDED, DT_REMOVED, DT_MODIFIED }; + +//! Structure that describes a atomic delta on modification of the %Study + struct StudyDelta { + string m_father; + string m_entry; + DeltaType m_type; + }; + +//! A sequence of modification deltas + typedef sequence ListOfDeltas; //=========================================================================== /*! \brief %Study Interface @@ -404,6 +416,16 @@ during each working session. */ ListOfStrings GetLockerID(); +/*! \brief Enable or disable logging of modifications in this Study + \param isLogged is a Boolean flag that tells whether modification of the Study is logged. +*/ + void SetIsDeltaLogged(in boolean isLogged); + +/*! \brief Returns a list of modification deltas of this Study. Each call of GetLoggedDeltas clears + modification deltas stored in this Study. +*/ + ListOfDeltas GetLoggedDeltas(); + /*! \brief Create real variable with Name theVarName and value theValue (or set if variable value into theValue already exists) diff --git a/src/SALOMEDS/SALOMEDS_Study.cxx b/src/SALOMEDS/SALOMEDS_Study.cxx index eeb4c5d33..9a5b001b7 100644 --- a/src/SALOMEDS/SALOMEDS_Study.cxx +++ b/src/SALOMEDS/SALOMEDS_Study.cxx @@ -322,66 +322,69 @@ std::string SALOMEDS_Study::GetContext() std::vector SALOMEDS_Study::GetObjectNames(const std::string& theContext) { - std::vector aVector; + int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - aVector = _local_impl->GetObjectNames(theContext); - } - else { - SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetObjectNames((char*)theContext.c_str()); - aLength = aSeq->length(); - for (i = 0; i < aLength; i++) aVector.push_back(std::string((std::string)aSeq[i].in())); + return _local_impl->GetObjectNames(theContext); } + + SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetObjectNames((char*)theContext.c_str()); + aLength = aSeq->length(); + std::vector aVector(aLength); + for (i = 0; i < aLength; i++) aVector[i] = std::string((std::string)aSeq[i].in()); return aVector; } std::vector SALOMEDS_Study::GetDirectoryNames(const std::string& theContext) { - std::vector aVector; int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - aVector = _local_impl->GetDirectoryNames(theContext); - } - else { - SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetDirectoryNames((char*)theContext.c_str()); - aLength = aSeq->length(); - for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in()); + return _local_impl->GetDirectoryNames(theContext); } + + SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetDirectoryNames((char*)theContext.c_str()); + aLength = aSeq->length(); + std::vector aVector(aLength); + for (i = 0; i < aLength; i++) aVector[i] = (char*)aSeq[i].in(); + return aVector; } std::vector SALOMEDS_Study::GetFileNames(const std::string& theContext) { - std::vector aVector; + int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - aVector = _local_impl->GetFileNames(theContext); + return _local_impl->GetFileNames(theContext); } - else { - SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetFileNames((char*)theContext.c_str()); - aLength = aSeq->length(); + + SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetFileNames((char*)theContext.c_str()); + aLength = aSeq->length(); + std::vector aVector(aLength); + + for (i = 0; i < aLength; i++) aVector[i] = (char*)aSeq[i].in(); - for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in()); - } return aVector; } std::vector SALOMEDS_Study::GetComponentNames(const std::string& theContext) { - std::vector aVector; + int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - aVector = _local_impl->GetComponentNames(theContext); - } - else { - SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetComponentNames((char*)theContext.c_str()); - aLength = aSeq->length(); - for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in()); + return _local_impl->GetComponentNames(theContext); } + + SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetComponentNames((char*)theContext.c_str()); + aLength = aSeq->length(); + std::vector aVector(aLength); + + for (i = 0; i < aLength; i++) aVector[i] = (char*)aSeq[i].in(); + return aVector; } @@ -584,17 +587,19 @@ std::string SALOMEDS_Study::GetLastModificationDate() std::vector SALOMEDS_Study::GetModificationsDate() { - std::vector aVector; + int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - aVector = _local_impl->GetModificationsDate(); - } - else { - SALOMEDS::ListOfDates_var aSeq = _corba_impl->GetModificationsDate(); - aLength = aSeq->length(); - for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in()); + return _local_impl->GetModificationsDate(); } + + SALOMEDS::ListOfDates_var aSeq = _corba_impl->GetModificationsDate(); + aLength = aSeq->length(); + std::vector aVector(aLength); + + for (i = 0; i < aLength; i++) aVector[i] = (char*)aSeq[i].in(); + return aVector; } @@ -666,20 +671,48 @@ void SALOMEDS_Study::UnLockStudy(const string& theLockerID) vector SALOMEDS_Study::GetLockerID() { - std::vector aVector; int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - aVector = _local_impl->GetLockerID(); - } - else { - SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetLockerID(); - aLength = aSeq->length(); - for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in()); + return _local_impl->GetLockerID(); } + + SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetLockerID(); + aLength = aSeq->length(); + std::vector aVector(aLength); + for (i = 0; i < aLength; i++) aVector[i] = (char*)aSeq[i].in(); + return aVector; } +void SALOMEDS_Study::SetIsDeltaLogged(bool isLogged) +{ + if (_isLocal) { + SALOMEDS::Locker lock; + _local_impl->SetIsDeltaLogged(isLogged); + } + else _corba_impl->SetIsDeltaLogged(isLogged); +} + +std::vector< StudyDelta > SALOMEDS_Study::GetLoggedDeltas() +{ + if (_isLocal) { + SALOMEDS::Locker lock; + return _local_impl->GetLoggedDeltas(); + } + + SALOMEDS::ListOfDeltas_var aSeq = _corba_impl->GetLoggedDeltas(); + int aLength = aSeq->length(); + std::vector< StudyDelta > aVector(aLength); + for(int i = 0; i SALOMEDS_Study::GetVariableNames() { - vector aVector; if (_isLocal) { SALOMEDS::Locker lock; - aVector = _local_impl->GetVariableNames(); - } - else { - SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetVariableNames(); - int aLength = aSeq->length(); - for (int i = 0; i < aLength; i++) - aVector.push_back( string(aSeq[i].in()) ); + return _local_impl->GetVariableNames(); } + + SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetVariableNames(); + int aLength = aSeq->length(); + vector aVector(aLength); + for (int i = 0; i < aLength; i++) + aVector[i] = string(aSeq[i].in()); + return aVector; } @@ -907,22 +940,24 @@ bool SALOMEDS_Study::IsVariableUsed(const string& theVarName) vector< vector > SALOMEDS_Study::ParseVariables(const string& theVars) { - vector< vector > aResult; if (_isLocal) { SALOMEDS::Locker lock; - aResult = _local_impl->ParseVariables(theVars); + return _local_impl->ParseVariables(theVars); } - else { - SALOMEDS::ListOfListOfStrings_var aSeq = _corba_impl->ParseVariables(theVars.c_str()); - for (int i = 0, n = aSeq->length(); i < n; i++) { - vector aVector; - SALOMEDS::ListOfStrings aSection = aSeq[i]; - for (int j = 0, m = aSection.length(); j < m; j++) { - aVector.push_back( string(aSection[j].in()) ); - } - aResult.push_back( aVector ); + + SALOMEDS::ListOfListOfStrings_var aSeq = _corba_impl->ParseVariables(theVars.c_str()); + vector< vector > aResult(aSeq->length()); + for (int i = 0, n = aSeq->length(); i < n; i++) { + + SALOMEDS::ListOfStrings aSection = aSeq[i]; + vector aVector(aSection.length()); + + for (int j = 0, m = aSection.length(); j < m; j++) { + aVector[j] = string(aSection[j].in()); } + aResult[i] = aVector; } + return aResult; } diff --git a/src/SALOMEDS/SALOMEDS_Study.hxx b/src/SALOMEDS/SALOMEDS_Study.hxx index d99a6c460..f99f9810a 100644 --- a/src/SALOMEDS/SALOMEDS_Study.hxx +++ b/src/SALOMEDS/SALOMEDS_Study.hxx @@ -98,6 +98,9 @@ public: virtual void UnLockStudy(const std::string& theLockerID); virtual std::vector GetLockerID(); + virtual void SetIsDeltaLogged(bool isLogged); + virtual std::vector< StudyDelta > GetLoggedDeltas(); + virtual void SetReal(const std::string& theVarName, const double theValue); virtual void SetInteger(const std::string& theVarName, const int theValue); virtual void SetBoolean(const std::string& theVarName, const bool theValue); diff --git a/src/SALOMEDS/SALOMEDS_Study_i.cxx b/src/SALOMEDS/SALOMEDS_Study_i.cxx index bf3f7660a..cfc1f478d 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.cxx @@ -881,6 +881,43 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetLockerID() } return aResult._retn(); } + +//============================================================================ +/*! Function : SetIsDeltaLogged + * Purpose : + */ +//============================================================================ +void SALOMEDS_Study_i::SetIsDeltaLogged(CORBA::Boolean isLogged) +{ + if(isLogged) _impl->SetIsDeltaLogged(true); + else _impl->SetIsDeltaLogged(false); +} + +//============================================================================ +/*! Function : GetLoggedDeltas + * Purpose : + */ +//============================================================================ +SALOMEDS::ListOfDeltas* SALOMEDS_Study_i::GetLoggedDeltas() +{ + const vector< StudyDelta >& aList = _impl->GetLoggedDeltas(); + SALOMEDS::ListOfDeltas_var aDeltas = new SALOMEDS::ListOfDeltas(); + + aDeltas->length(aList.size()); + for(size_t i = 0, aSize = aList.size(); i GetLockerID() = 0; + virtual void SetIsDeltaLogged(bool isLogged) = 0; + virtual std::vector< StudyDelta > GetLoggedDeltas() = 0; + virtual void SetReal(const std::string& theVarName, const double theValue) = 0; virtual void SetInteger(const std::string& theVarName, const int theValue) = 0; virtual void SetBoolean(const std::string& theVarName, const bool theValue) = 0; diff --git a/src/SALOMEDSClient/SALOMEDSClient_definitions.hxx b/src/SALOMEDSClient/SALOMEDSClient_definitions.hxx index 9d3dc8144..12e733138 100644 --- a/src/SALOMEDSClient/SALOMEDSClient_definitions.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient_definitions.hxx @@ -78,4 +78,25 @@ struct STextColor double B; }; +enum DeltaOperationType { DOT_NONE, DOT_SO_ADDED, DOT_SO_REMOVED, DOT_MODIFIED }; + +#include + +struct StudyDelta { + StudyDelta() { m_father = ""; m_entry = ""; m_type = DOT_NONE; } + StudyDelta(const std::string& theFather, + const std::string& theEntry, + DeltaOperationType theOperation) + { + m_father = theFather; + m_entry = theEntry; + m_type = theOperation; + } + + std::string m_father; //Entry of a father SObject + std::string m_entry; //Entry of modified SObject + DeltaOperationType m_type; //What operation is performed +}; + + #endif diff --git a/src/SALOMEDSImpl/Makefile.am b/src/SALOMEDSImpl/Makefile.am index 731cf625a..4d8def016 100644 --- a/src/SALOMEDSImpl/Makefile.am +++ b/src/SALOMEDSImpl/Makefile.am @@ -96,6 +96,7 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../HDFPersist \ -I$(srcdir)/../DF \ -I$(srcdir)/../GenericObj \ + -I$(srcdir)/../SALOMEDSClient \ -I$(top_builddir)/idl \ @HDF5_INCLUDES@ \ @BOOST_CPPFLAGS@ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx index b1148f59c..35ebfd755 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx @@ -87,5 +87,10 @@ void SALOMEDSImpl_GenericAttribute::SetModifyFlag() SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel); if(aStudy) aStudy->Modify(); + else return; + + if(aStudy->IsDeltaLogged()) { //It's necessary to store in the Study about attributes' modifications + aStudy->AddDelta(DF_Label(), aLabel, DOT_MODIFIED); + } } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx index 68fa75f94..790e20354 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx @@ -239,7 +239,11 @@ string SALOMEDSImpl_SObject::GetIOR() const return aStr; } - +//============================================================================ +/*! Function : GetGUID + * Purpose : + */ +//============================================================================ std::string SALOMEDSImpl_SObject::GetGUID(const string& theType) { __AttributeTypeToGUIDForSObject @@ -250,6 +254,42 @@ std::string SALOMEDSImpl_SObject::GetGUID(const string& theType) return ""; } +//============================================================================ +/*! Function : OnAddition + * Purpose : The method is called after when this SObject is added to the Study + */ +//============================================================================ +void SALOMEDSImpl_SObject::OnAddition() const +{ + if(_lab.IsNull()) return; + + SALOMEDSImpl_Study* aStudy = GetStudy(); + if(!aStudy || !aStudy->IsDeltaLogged()) return; + + DF_Label aFather; + if(!IsComponent()) aFather = _lab.Father(); + + aStudy->AddDelta(aFather, _lab, DOT_SO_ADDED); +} + +//============================================================================ +/*! Function : OnRemove + * Purpose : The method is called before when this SObject is removed from the Study + */ +//============================================================================ +void SALOMEDSImpl_SObject::OnRemove() const +{ + if(_lab.IsNull()) return; + + SALOMEDSImpl_Study* aStudy = GetStudy(); + if(!aStudy || !aStudy->IsDeltaLogged()) return; + + DF_Label aFather; + if(!IsComponent()) aFather = _lab.Father(); + + aStudy->AddDelta(aFather, _lab, DOT_SO_REMOVED); +} + //============================================================================ /*! Function : SALOMEDSImpl_SComponent * Purpose : diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx index 40162ddb3..9501f6039 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx @@ -72,6 +72,9 @@ public: virtual DF_Label GetLabel() const { return _lab; } + virtual void OnAddition() const; + virtual void OnRemove() const; + bool IsNull() const { return _lab.IsNull(); } bool IsComponent() const; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index d3f93e848..07f3d3b7f 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -68,6 +68,7 @@ SALOMEDSImpl_Study::SALOMEDSImpl_Study(const DF_Document* doc, _useCaseBuilder = new SALOMEDSImpl_UseCaseBuilder(_doc); _builder = new SALOMEDSImpl_StudyBuilder(this); _cb = new SALOMEDSImpl_Callback(_useCaseBuilder); + _isDelta = false; //Put on the root label a StudyHandle attribute to store the address of this object //It will be used to retrieve the study object by DF_Label that belongs to the study SALOMEDSImpl_StudyHandle::Set(_doc->Main().Root(), this); @@ -1971,3 +1972,88 @@ vector SALOMEDSImpl_Study::GetIORs() return anIORs; } + +//============================================================================ +/*! Function : IsDeltaLogged + * Purpose : + */ +//============================================================================ +bool SALOMEDSImpl_Study::IsDeltaLogged() const +{ + return _isDelta; +} + +//============================================================================ +/*! Function : GetLoggedDeltas + * Purpose : + */ +//============================================================================ +vector< StudyDelta > SALOMEDSImpl_Study::GetLoggedDeltas() +{ + vector< StudyDelta > aDeltas(_deltas.size()); + + map::const_iterator p = _deltas.begin(); + + for(size_t i = 0; p != _deltas.end(); i++, p++) { + aDeltas[i] = p->second; + } + + _deltas.clear(); + + return aDeltas; +} + + +//============================================================================ +/*! Function : AddDelta + * Purpose : + */ +//============================================================================ +void SALOMEDSImpl_Study::AddDelta(const DF_Label& theFather, + const DF_Label& theObject, + DeltaOperationType theOperation) +{ + if(theObject.IsNull()) return; + const string& entry = theObject.Entry(); + + if(_deltas.find(entry) != _deltas.end()) { //Check whether the object was already modified in any way + StudyDelta& aDelta = _deltas[entry]; + + switch(aDelta.m_type) { + case DOT_SO_ADDED: { + switch(theOperation) { + case DOT_SO_REMOVED: { _deltas.erase(_deltas.find(entry)); } //Remove delta as the object which has been added is removed + default: + return; + } + break; + } + case DOT_SO_REMOVED: { + switch(theOperation) { + case DOT_SO_ADDED: { //The previously removed is again added, modify the delta to MODIFIED + aDelta.m_type = DOT_MODIFIED; + aDelta.m_father = ""; + } + default: + return; + } + break; + } + case DOT_MODIFIED: { + switch(theOperation) { + case DOT_SO_REMOVED: { //The previously modified object is removed, keep only the removal delta + aDelta.m_type = DOT_SO_REMOVED; + aDelta.m_father = theObject.Father().Entry(); + } + default: + return; + } + break; + } + default: return; + } + } + else { + _deltas[entry] = StudyDelta(theFather.Entry(), theObject.Entry(), theOperation); + } +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx index 8730cff42..bacb9e794 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx @@ -36,6 +36,9 @@ #include "DF_Label.hxx" #include +//SALOMEDSClient headers +#include "SALOMEDSClient_definitions.hxx" + //SALOMEDSImpl headers #include "SALOMEDSImpl_Defines.hxx" #include "SALOMEDSImpl_SComponentIterator.hxx" @@ -53,7 +56,6 @@ class SALOMEDSImpl_StudyManager; class SALOMEDSImpl_GenericAttribute; - class SALOMEDSIMPL_EXPORT SALOMEDSImpl_Study { private: @@ -69,6 +71,8 @@ private: SALOMEDSImpl_Callback* _cb; SALOMEDSImpl_StudyBuilder* _builder; SALOMEDSImpl_UseCaseBuilder* _useCaseBuilder; + bool _isDelta; + std::map _deltas; std::map _mapOfSO; std::map _mapOfSCO; @@ -309,11 +313,29 @@ public: //Returns a callback SALOMEDSImpl_Callback* GetCallback() { return _cb; } + //Enables logging of modifications in SALOME data structure. + //Default value is 'false' + void SetIsDeltaLogged(bool isLogged) { _isDelta = isLogged; } + + //Returns true if the study stores a list of modifications related to the SObjects and Attributes + bool IsDeltaLogged() const; + + //Returns a list of deltas on modifications that happend after the last request of deltas + //Note: The request for deltas clears all stored information, so only returned list will contain + // information about modifications + std::vector< StudyDelta > GetLoggedDeltas(); + //Returns a list of IOR's stored in the study std::vector GetIORs(); +protected: + + //Adds a new Delta to the list of modifications + void AddDelta(const DF_Label& theFather, const DF_Label& theObject, DeltaOperationType theOperation); + friend class SALOMEDSImpl_StudyManager; friend class SALOMEDSImpl_GenericAttribute; friend class SALOMEDSImpl_GenericVariable; + friend class SALOMEDSImpl_SObject; }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx index d09c10e25..1694348db 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx @@ -87,9 +87,10 @@ SALOMEDSImpl_SComponent SALOMEDSImpl_StudyBuilder::NewComponent(const string& Da DF_Label NL = L.NewChild(); - SALOMEDSImpl_AttributeComment::Set(NL, DataType); - SALOMEDSImpl_SComponent so = _study->GetSComponent (NL); + so.OnAddition(); + + SALOMEDSImpl_AttributeComment::Set(NL, DataType); if(_callbackOnAdd) _callbackOnAdd->OnAddSObject(so); @@ -148,6 +149,8 @@ SALOMEDSImpl_SObject SALOMEDSImpl_StudyBuilder::NewObject(const SALOMEDSImpl_SOb DF_Label NewLab = Lab.NewChild(); SALOMEDSImpl_SObject so = _study->GetSObject(NewLab); + so.OnAddition(); + if(_callbackOnAdd) _callbackOnAdd->OnAddSObject(so); _doc->SetModified(true); @@ -171,6 +174,7 @@ SALOMEDSImpl_SObject SALOMEDSImpl_StudyBuilder::NewObjectToTag(const SALOMEDSImp DF_Label NewLab = Lab.FindChild(theTag, 1); SALOMEDSImpl_SObject so = _study->GetSObject(NewLab); + so.OnAddition(); if(_callbackOnAdd) _callbackOnAdd->OnAddSObject(so); @@ -191,7 +195,8 @@ bool SALOMEDSImpl_StudyBuilder::RemoveObject(const SALOMEDSImpl_SObject& anObjec _errorCode = "Null object"; return false; } - + + anObject.OnRemove(); if(_callbackOnRemove) _callbackOnRemove->OnRemoveSObject(anObject); DF_Label Lab = anObject.GetLabel(); @@ -229,6 +234,7 @@ bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const SALOMEDSImpl_SObj return false; } + anObject.OnRemove(); if(_callbackOnRemove) _callbackOnRemove->OnRemoveSObject(anObject); DF_Label Lab = anObject.GetLabel(); @@ -247,6 +253,10 @@ bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const SALOMEDSImpl_SObj DF_ChildIterator it(Lab, true); for(;it.More();it.Next()) { DF_Label aLabel = it.Value(); + + SALOMEDSImpl_SObject so(aLabel); + so.OnRemove(); + if ((aReference=(SALOMEDSImpl_AttributeReference*)aLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { SALOMEDSImpl_AttributeTarget* aTarget = NULL; if ((aTarget=(SALOMEDSImpl_AttributeTarget*)aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) diff --git a/src/SALOMEDSImpl/Test/Makefile.am b/src/SALOMEDSImpl/Test/Makefile.am index 348d2c7c9..8a4983c3b 100644 --- a/src/SALOMEDSImpl/Test/Makefile.am +++ b/src/SALOMEDSImpl/Test/Makefile.am @@ -57,6 +57,7 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/ResourcesManager \ -I$(srcdir)/$(RPATH)/LifeCycleCORBA \ -I$(srcdir)/$(RPATH)/DF \ + -I$(srcdir)/$(RPATH)/SALOMEDSClient \ -I$(srcdir)/$(RPATH)/SALOMEDSImpl \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@ -- 2.39.2