1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SALOME_Notebook.hxx
23 // Author : Alexandre SOLOVYOV
26 #ifndef __SALOME_NOTEBOOK_H__
27 #define __SALOME_NOTEBOOK_H__
29 #include <SALOMEconfig.h>
30 #include CORBA_SERVER_HEADER(SALOME_Notebook)
31 #include CORBA_SERVER_HEADER(SALOMEDS)
32 #include <SALOME_GenericObj_i.hh>
37 class SALOME_Parameter;
39 class SALOME_Notebook : public virtual POA_SALOME::Notebook, public virtual SALOME::GenericObj_i
42 SALOME_Notebook( SALOMEDS::Study_ptr theStudy );
44 virtual CORBA::Boolean AddDependency( SALOME::ParameterizedObject_ptr theObj, SALOME::ParameterizedObject_ptr theRef );
45 virtual void RemoveDependency( SALOME::ParameterizedObject_ptr theObj, SALOME::ParameterizedObject_ptr theRef );
46 virtual void ClearDependencies( SALOME::ParameterizedObject_ptr theObj );
47 virtual void SetToUpdate( SALOME::ParameterizedObject_ptr theObj );
48 virtual void Update();
50 virtual CORBA::Boolean AddExpr( const char* theExpr );
51 virtual CORBA::Boolean AddNameExpr( const char* theName, const char* theExpr );
52 virtual CORBA::Boolean AddValue( const char* theName, CORBA::Double theValue );
53 virtual void Remove( const char* theParamName );
54 virtual SALOME::Parameter_ptr Param( const char* theParamName );
56 SALOME_Parameter* ParamPtr( const char* theParamName ) const;
59 bool AddParam( SALOME_Parameter* theParam );
60 bool AddDependencies( SALOME_Parameter* theParam );
61 bool AddDependency( const std::string& theObjKey, const std::string& theRefKey );
62 void ClearDependencies( const std::string& theObjKey );
65 std::string GetKey( SALOME::ParameterizedObject_ptr theObj );
66 std::string GetKey( const std::string& theParamName );
68 //! return list of objects that depend on object with given key
69 std::list<std::string> GetAllDependingOn( const std::string& theKey );
70 SALOME::ParameterizedObject_ptr FindObject( const std::string& theKey );
73 std::map< std::string, std::list<std::string> > myDeps;
74 std::map< std::string, SALOME_Parameter* > myParams;
76 friend class KeyHelper;
80 KeyHelper( const std::string& theKey, SALOME_Notebook* theNotebook );
81 std::string key() const;
82 bool operator < ( const KeyHelper& theKH ) const;
83 bool operator == ( const std::string& theKey ) const;
87 SALOME_Notebook* myNotebook;
89 std::list< KeyHelper > myToUpdate;
91 SALOMEDS::Study_var myStudy;