SALOME_EvalExpr.hxx \
SALOME_EvalParser.hxx \
SALOME_EvalSet.hxx \
- SALOME_EvalVariant.hxx
+ SALOME_EvalVariant.hxx \
+ SALOME_ParameterizedObject.hxx
# Scripts to be installed
dist_salomescript_PYTHON=
SALOME_EvalExpr.cxx \
SALOME_EvalParser.cxx \
SALOME_EvalSet.cxx \
- SALOME_EvalVariant.cxx
+ SALOME_EvalVariant.cxx \
+ SALOME_ParameterizedObject.cxx
libSalomeNotebook_la_CPPFLAGS = $(COMMON_CPPFLAGS)
libSalomeNotebook_la_LDFLAGS = -Wl,-E -no-undefined -version-info=0:0:0 @LDEXPDYNFLAGS@
bool SALOME_Notebook::CanUpdate( SALOME::ParameterizedObject_ptr theObj ) const
{
- if( CORBA::is_nil( theObj ) )
+ if( CORBA::is_nil( theObj ) || theObj->_non_existent() )
return false;
SALOME::Parameter_var aParam = SALOME::Parameter::_narrow( theObj );
//Utils_Locker lock( &myMutex );
//1. Simple recompute
- std::list< KeyHelper > aPostponedUpdate;
+ std::list<KeyHelper> aPostponedUpdate;
std::list<KeyHelper>::const_iterator it = myToUpdate.begin(), last = myToUpdate.end();
for( ; it!=last; it++ )
{
ThrowError( aMsg );
}
+void SALOME_Notebook::RemoveObject( SALOME::ParameterizedObject_ptr theObject )
+{
+ if( theObject->GetComponent()==PARAM_COMPONENT )
+ Remove( theObject->GetEntry() );
+
+ std::list<std::string> anObjToRemove;
+ std::string aKey = GetKey( theObject );
+
+ std::map< std::string, std::list<std::string> >::iterator it = myDependencies.begin(), last = myDependencies.end();
+ for( ; it!=last; it++ )
+ {
+ it->second.remove( aKey );
+ if( it->second.size()==0 )
+ anObjToRemove.push_back( it->first );
+ }
+
+ std::list<std::string>::const_iterator rit = anObjToRemove.begin(), rlast = anObjToRemove.end();
+ for( ; rit!=rlast; rit++ )
+ myDependencies.erase( *rit );
+
+ std::list<KeyHelper>::iterator uit = myToUpdate.begin(), ulast = myToUpdate.end();
+ for( ; uit!=ulast; uit++ )
+ if( uit->key()==aKey )
+ myToUpdate.erase( uit );
+}
+
void SALOME_Notebook::Remove( const char* theParamName )
{
SALOME_Parameter* aParam = GetParameterPtr( theParamName );
virtual void AddInteger( const char* theName, CORBA::Long theValue );
virtual void AddReal( const char* theName, CORBA::Double theValue );
virtual void AddString( const char* theName, const char* theValue );
+ virtual void RemoveObject( SALOME::ParameterizedObject_ptr theObject );
virtual void Remove( const char* theParamName );
virtual void Rename( const char* theOldName, const char* theNewName );
virtual SALOME::Parameter_ptr GetParameter( const char* theParamName );
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : SALOME_ParameterizedObject.cxx
+// Author : Alexandre SOLOVYOV
+// Module : SALOME
+
+#include <SALOME_ParameterizedObject.hxx>
+
+SALOME_ParameterizedObject::SALOME_ParameterizedObject( SALOME::Notebook_ptr theNotebook )
+{
+ myNotebook = theNotebook;
+}
+
+void SALOME_ParameterizedObject::BeforeDeactivate()
+{
+ if( !CORBA::is_nil( myNotebook ) )
+ myNotebook->RemoveObject( _this() );
+}
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : SALOME_ParameterizedObject.hxx
+// Author : Alexandre SOLOVYOV
+// Module : SALOME
+//
+#ifndef __SALOME_PARAMETERIZED_OBJECT_H__
+#define __SALOME_PARAMETERIZED_OBJECT_H__
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOME_Notebook)
+#include <SALOME_GenericObj_i.hh>
+
+class SALOME_ParameterizedObject : public virtual POA_SALOME::ParameterizedObject, public virtual SALOME::GenericObj_i
+{
+public:
+ SALOME_ParameterizedObject( SALOME::Notebook_ptr theNotebook );
+
+ virtual void BeforeDeactivate();
+
+private:
+ SALOME::Notebook_var myNotebook;
+};
+
+#endif