Salome HOME
PR: mergefrom branch BR_V3_1_0_PR tag mergeto_trunk_02feb06
authorprascle <prascle>
Thu, 2 Feb 2006 10:33:36 +0000 (10:33 +0000)
committerprascle <prascle>
Thu, 2 Feb 2006 10:33:36 +0000 (10:33 +0000)
60 files changed:
bin/createAppli.sh
bin/runSalome.py
idl/SALOMEDS.idl
salome_adm/unix/config_files/check_boost.m4
salome_adm/unix/config_files/check_lam.m4
salome_adm/unix/config_files/check_pthreads.m4
salome_adm/unix/make_commence.in
src/Communication/ReceiverFactory.cxx
src/Communication/Receivers.cxx
src/Communication/Receivers.hxx
src/Communication/SALOME_Comm_i.cxx
src/SALOMEDS/SALOMEDS_AttributeComment.cxx
src/SALOMEDS/SALOMEDS_AttributeDrawable.cxx
src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx
src/SALOMEDS/SALOMEDS_AttributeExpandable.cxx
src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx
src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.cxx
src/SALOMEDS/SALOMEDS_AttributeFileType.cxx
src/SALOMEDS/SALOMEDS_AttributeFlags.cxx
src/SALOMEDS/SALOMEDS_AttributeGraphic.cxx
src/SALOMEDS/SALOMEDS_AttributeIOR.cxx
src/SALOMEDS/SALOMEDS_AttributeInteger.cxx
src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx
src/SALOMEDS/SALOMEDS_AttributeName.cxx
src/SALOMEDS/SALOMEDS_AttributeOpened.cxx
src/SALOMEDS/SALOMEDS_AttributePersistentRef.cxx
src/SALOMEDS/SALOMEDS_AttributePixMap.cxx
src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx
src/SALOMEDS/SALOMEDS_AttributePythonObject.cxx
src/SALOMEDS/SALOMEDS_AttributeReal.cxx
src/SALOMEDS/SALOMEDS_AttributeSelectable.cxx
src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.cxx
src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.cxx
src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx
src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx
src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx
src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx
src/SALOMEDS/SALOMEDS_AttributeTarget.cxx
src/SALOMEDS/SALOMEDS_AttributeTextColor.cxx
src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.cxx
src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx
src/SALOMEDS/SALOMEDS_AttributeUserID.cxx
src/SALOMEDS/SALOMEDS_ChildIterator.cxx
src/SALOMEDS/SALOMEDS_Driver_i.cxx
src/SALOMEDS/SALOMEDS_GenericAttribute.cxx
src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx
src/SALOMEDS/SALOMEDS_SComponent.cxx
src/SALOMEDS/SALOMEDS_SComponentIterator.cxx
src/SALOMEDS/SALOMEDS_SObject.cxx
src/SALOMEDS/SALOMEDS_Study.cxx
src/SALOMEDS/SALOMEDS_StudyBuilder.cxx
src/SALOMEDS/SALOMEDS_StudyManager.cxx
src/SALOMEDS/SALOMEDS_StudyManager.hxx
src/SALOMEDS/SALOMEDS_StudyManager_i.cxx
src/SALOMEDS/SALOMEDS_StudyManager_i.hxx
src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx
src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx
src/SALOMEDSClient/SALOMEDSClient_StudyManager.hxx
src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx

index c6c4de07287f95b0343aeea44186648861db767f..1ff6ed6def573fd3c20538caec9fa47e80559aa4 100755 (executable)
@@ -3,5 +3,15 @@
 comName=`which $0`
 rep=`dirname $comName`
 
-cp -r $rep/appliskel $1
-chmod +x $1/*.sh $1/run* $1/envd
+if [ $# -ne 1 ]
+  echo "--- usage:"
+  echo $0 AppliName
+  echo "--- In which AppliName is a directory to create with SALOME application scripts"
+elif [ -d $1]
+  echo $1 "directory already exists, nothing done"
+else
+  mkdir -p $1
+  cp -r $rep/appliskel/* $1
+  cp $rep/appliskel/.bashrc $1
+  chmod +x $1/*.sh $1/run* $1/envd
+fi
\ No newline at end of file
index 9d0a669711ce120fc1f792b9b2672313730f2ede..98ff0a19fe5369b9677d5d09d3f29ede95ef21a4 100755 (executable)
@@ -65,7 +65,7 @@ def get_config():
 
     to_remove_list=[]
     for module in modules_list :
-        module_variable=module.upper()+"_ROOT_DIR"
+        module_variable=module+"_ROOT_DIR"
         if not os.environ.has_key(module_variable):
             print "*******************************************************"
             print "*"
@@ -155,10 +155,18 @@ def set_env(args, modules_list, modules_root_dir):
             pass
         if args.has_key("SMESH_plugins"):
             for plugin in args["SMESH_plugins"]:
-                if os.environ.has_key(plugin.upper()+"_ROOT_DIR"):
+                plugin_root = ""
+                if os.environ.has_key(plugin+"_ROOT_DIR"):
+                    plugin_root = os.environ[plugin+"_ROOT_DIR"]
+                else:
+                    # workaround to avoid modifications of existing environment
+                    if os.environ.has_key(plugin.upper()+"_ROOT_DIR"):
+                        plugin_root = os.environ[plugin.upper()+"_ROOT_DIR"]
+                        pass
+                    pass
+                if plugin_root != "":
                     os.environ["SMESH_MeshersList"] \
                     = os.environ["SMESH_MeshersList"]+":"+plugin
-                    plugin_root = os.environ[plugin.upper()+"_ROOT_DIR"]
                     if not os.environ.has_key("SALOME_"+plugin+"Resources"):
                         os.environ["SALOME_"+plugin+"Resources"] \
                         = plugin_root+"/share/"+args["appname"]+"/resources"
index 7c0844a317ad6575350b7a30a44a6fbe0601b41b..de883d82e681e95cc852506674669dfff503fb73 100644 (file)
@@ -695,13 +695,13 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin
 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
-    void  Save(in  Study aStudy, in boolean theMultiFile);
+    boolean  Save(in  Study aStudy, in boolean theMultiFile);
 /*! \brief Saving a study in a ASCII file (or files).
 
     Saves a study in an ASCII format file (or files).
     \param theMultiFile If this parameter is True the study will be saved in several files.
 */
-    void  SaveASCII(in  Study aStudy, in boolean theMultiFile);
+    boolean  SaveASCII(in  Study aStudy, in boolean theMultiFile);
 /*! \brief Saving the study in a specified HDF file (or files).
 
     Saves the study in a specified file (or files).
@@ -711,7 +711,7 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin
 
  <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
-    void  SaveAs(in URL   aUrl, // if the file already exists
+    boolean  SaveAs(in URL   aUrl, // if the file already exists
                in Study aStudy,
                in boolean theMultiFile); // overwrite (as option)
 /*! \brief Saving the study in a specified ASCII file (or files).
@@ -722,7 +722,7 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin
     \param aStudy The study which will be saved
     \param theMultiFile If this parameter is True the study will be saved in several files.
 */
-    void  SaveAsASCII(in URL   aUrl, // if the file already exists
+    boolean  SaveAsASCII(in URL   aUrl, // if the file already exists
                      in Study aStudy,
                      in boolean theMultiFile); // overwrite (as option)
 
index 215ce8cf53b859b155f347da3f6ac66a1c0266ba..b5e475ffa3b244ea4072f04ebfa35b000d80151b 100644 (file)
@@ -28,6 +28,13 @@ AC_LANG_CPLUSPLUS
 
 AC_SUBST(BOOST_CPPFLAGS)
 BOOST_CPPFLAGS=""
+
+AC_SUBST(BOOST_LIBS)
+BOOST_LIBS=""
+
+AC_SUBST(BOOST_LIBTHREAD)
+BOOST_LIBTHREAD=""
+
 boost_ok=no
 
 if test -z ${BOOSTDIR}; then
@@ -37,17 +44,42 @@ if test -z ${BOOSTDIR}; then
   fi
 else
   AC_MSG_RESULT(\$BOOSTDIR = ${BOOSTDIR})
-  AC_CHECKING(for boost/shared_ptr.hpp header file)
+
   dnl BOOST headers
+  AC_CHECKING(for boost/shared_ptr.hpp header file)
   CPPFLAGS_old="${CPPFLAGS}"
-  BOOST_CPPFLAGS="-I${BOOSTDIR}"
+  BOOST_CPPFLAGS="-I${BOOSTDIR}/include"
   CPPFLAGS="${CPPFLAGS} ${BOOST_CPPFLAGS}"
 
   AC_CHECK_HEADER(boost/shared_ptr.hpp,boost_ok=yes,boost_ok=no)
 
   CPPFLAGS="${CPPFLAGS_old}"
+
+  if test "x${boost_ok}" = "xyes" ; then
+    AC_MSG_RESULT(\$BOOST_CPPFLAGS = ${BOOST_CPPFLAGS})
+    dnl BOOST libs
+    AC_CHECKING(for libboost_thread-mt.so library file)
+    AC_CHECK_FILE(${BOOSTDIR}/lib/libboost_thread-mt.so,boost_ok=yes,boost_ok=no)
+    if test "x${boost_ok}" = "xyes" ; then
+      BOOST_LIBS="-L${BOOSTDIR}/lib"
+      AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS})
+      BOOST_LIBTHREAD="libboost_thread-mt.so"
+      AC_MSG_RESULT(\$BOOST_LIBTHREAD = ${BOOST_LIBTHREAD})
+    else
+      AC_CHECKING(for libboost_thread.so library file)
+      AC_CHECK_FILE(${BOOSTDIR}/lib/libboost_thread.so,boost_ok=yes,boost_ok=no)
+      if test "x${boost_ok}" = "xyes" ; then
+        BOOST_LIBS="-L${BOOSTDIR}/lib"
+        AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS})
+        BOOST_LIBTHREAD="libboost_thread.so"
+        AC_MSG_RESULT(\$BOOST_LIBTHREAD = ${BOOST_LIBTHREAD})
+      fi
+    fi
+  fi
 fi
 
+AC_MSG_RESULT(for boost: $boost_ok)
+
 AC_LANG_RESTORE
 
 ])dnl
index d15fdde312cbb7238625970aabf5c089372420c9..4a9941e2c98fe05d3d15087442300a9d80224609 100644 (file)
@@ -88,8 +88,25 @@ if test "$WITHLAM" = yes; then
       AC_CHECK_LIB(mpi,MPI_Init,WITHLAM="yes",WITHLAM="no")
       if test "$WITHLAM" = "yes";then
         MPI_LIBS="-lmpi $MPI_LIBS"
+        LIBS="-lmpi $LIBS"
       fi
 
+      AC_LANG_SAVE
+      AC_LANG_CPLUSPLUS
+      LIBS="-llammpi++ $LIBS"
+      AC_MSG_CHECKING(for MPI_Init in -llammpi++)
+      AC_TRY_LINK([
+         #include <mpi.h>
+         ], [MPI::Init();],
+         WITHLAM="yes",WITHLAM="no")
+      if test "$WITHLAM" = "yes";then
+        AC_MSG_RESULT(yes)
+        MPI_LIBS="-llammpi++ $MPI_LIBS"
+      else
+        AC_MSG_RESULT(no)
+      fi
+      AC_LANG_RESTORE
+
       AC_CHECK_LIB(mpi,MPI_Publish_name,WITHMPI2="yes",WITHMPI2="no")
 
     fi
index 80aef2aad184d0e6509be9383e3422b254bf336c..d5033889e9cf46426843454e85dbd833853be25f 100644 (file)
@@ -38,6 +38,8 @@ if test $flag = no; then
   AC_CHECK_LIB(posix4,nanosleep, LIBS_PTHREADS="-lposix4",LIBS_PTHREADS="")
   AC_CHECK_LIB(pthread,pthread_mutex_lock, 
                LIBS_PTHREADS="-lpthread $LIBS_PTHREADS",LIBS_PTHREADS="")
+else
+  LDFLAGS="-pthread $LDFLAGS"
 fi
 
 if test $flag = no && x$LIBS_PTHREADS = x; then
index acd9fc70ab770b4285b085b5276c052bb3416b36..31535c4a62d8cf454c63bca49a035d11ee49cbcf 100644 (file)
@@ -42,6 +42,7 @@ CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@
 # BOOST Library
 
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_LIBS = @BOOST_LIBS@
 
 # OpenPBS
 
index f404a7ec3dcc4b65b827216ca84b4d23b2f84e98..94743bfae0525b6b1d320eb23657e03c23d7703e 100644 (file)
@@ -115,7 +115,7 @@ double *ReceiverFactory::getValueOneShot(SALOME::SenderDouble_ptr sender,long &s
   else if(!CORBA::is_nil(mpi_ptr))
     {
       CORBA::release(sender);
-      MPIReceiver<double,MPI_DOUBLE,SALOME::MPISenderDouble_ptr,SALOME::SenderDouble_ptr,SALOME_SenderDouble_i> rec(mpi_ptr);
+      MPIReceiver<double,SALOME::MPISenderDouble_ptr,SALOME::SenderDouble_ptr,SALOME_SenderDouble_i> rec(mpi_ptr);
       return rec.getValue(size);
     }
 #endif
@@ -165,7 +165,7 @@ int *ReceiverFactory::getValueOneShot(SALOME::SenderInt_ptr sender,long &size)th
   else if(!CORBA::is_nil(mpi_ptr))
     {
       CORBA::release(sender);
-      MPIReceiver<int,MPI_INT,SALOME::MPISenderInt_ptr,SALOME::SenderInt_ptr,SALOME_SenderInt_i> rec(mpi_ptr);
+      MPIReceiver<int,SALOME::MPISenderInt_ptr,SALOME::SenderInt_ptr,SALOME_SenderInt_i> rec(mpi_ptr);
       return rec.getValue(size);
     }
 #endif
index f97b4a1a4bf52918dbadcc45ad3bd9b71130e91c..f2ce1fa890eaef15cb38aec178efe11a6114d5eb 100644 (file)
@@ -154,17 +154,17 @@ T *CorbaWCWithCopyReceiver<T,TCorba,TSeqCorba,CorbaSender,servForT,ptrForT>::get
 
 #ifdef HAVE_MPI2
 
-template<class T,MPI_Datatype T2,class CorbaSender,class servForT,class ptrForT>
-MPIReceiver<T,T2,CorbaSender,servForT,ptrForT>::MPIReceiver(CorbaSender mySender):_mySender(mySender){
+template<class T,class CorbaSender,class servForT,class ptrForT>
+MPIReceiver<T,CorbaSender,servForT,ptrForT>::MPIReceiver(CorbaSender mySender):_mySender(mySender){
 }
 
-template<class T,MPI_Datatype T2,class CorbaSender,class servForT,class ptrForT>
-MPIReceiver<T,T2,CorbaSender,servForT,ptrForT>::~MPIReceiver(){
+template<class T,class CorbaSender,class servForT,class ptrForT>
+MPIReceiver<T,CorbaSender,servForT,ptrForT>::~MPIReceiver(){
   _mySender->release();
 }
 
-template<class T,MPI_Datatype T2,class CorbaSender,class servForT,class ptrForT>
-T *MPIReceiver<T,T2,CorbaSender,servForT,ptrForT>::getDistValue(long &size){
+template<class T,class CorbaSender,class servForT,class ptrForT>
+T *MPIReceiver<T,CorbaSender,servForT,ptrForT>::getDistValue(long &size){
   int i=0;
   int myproc;
   int sproc;
@@ -211,15 +211,15 @@ T *MPIReceiver<T,T2,CorbaSender,servForT,ptrForT>::getDistValue(long &size){
   }
   MPI_Recv( &_n, 1, MPI_LONG, sproc,p->tag1,com,&status);
   _v = new T[_n];
-  MPI_Recv( _v, _n, T2, sproc,p->tag2,com,&status);
+  MPI_Recv( _v, _n, MPITRAITS<T>::MpiType, sproc,p->tag2,com,&status);
   _mySender->close(p);
   MPI_Comm_disconnect( &com );  
   size=_n;
   return _v;
 }
 
-template<class T,MPI_Datatype T2,class CorbaSender,class servForT,class ptrForT>
-T *MPIReceiver<T,T2,CorbaSender,servForT,ptrForT>::getValue(long &size)
+template<class T,class CorbaSender,class servForT,class ptrForT>
+T *MPIReceiver<T,CorbaSender,servForT,ptrForT>::getValue(long &size)
 {
   return Receiver<T,servForT,ptrForT>::getValue(size,_mySender);
 }
index 203bf64dc12a225a518bfe14596f732c8d099db8..2dd44a854c9db69f4c01fafb2c6edaa6ffa8ee71 100644 (file)
@@ -94,7 +94,19 @@ private:
 /*!
   Receiver for MPI transfert.
  */
-template<class T,MPI_Datatype T2,class CorbaSender,class servForT,class ptrForT>
+template<class T>
+struct MPITRAITS
+{
+  static MPI_Datatype MpiType;
+};
+
+template<>
+MPI_Datatype MPITRAITS<double>::MpiType=MPI_DOUBLE;
+
+template<>
+MPI_Datatype MPITRAITS<int>::MpiType=MPI_INT;
+
+template<class T,class CorbaSender,class servForT,class ptrForT>
 class MPIReceiver : public Receiver<T,servForT,ptrForT>
 {
 private:
index f886b53878d6fe1934938241fe16402a1e35ead5..632ce7a7375cd2d1474af94cbbf9b6c0b965e9d3 100644 (file)
@@ -272,7 +272,7 @@ SALOME::MPISender::param* SALOME_MPISender_i::getParam()
 void SALOME_MPISender_i::send()
 {
   _type=getTypeOfDataTransmitted();
-  _argsForThr=new (void *)[8];
+  _argsForThr=new void *[8];
   _argsForThr[0]=_portName;
   _argsForThr[1]=&_lgrTabToSend;
   _argsForThr[2]=(void *)_tabToSend;
index 0d936c740b05e3808c5d8e0650ea73d472185292..3a54f00bb0843b05be0c092b685dec6115355f15 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeComment.hxx"
+#include "SALOMEDS.hxx"
 
 #include <string>
 #include <TCollection_AsciiString.hxx> 
@@ -41,15 +42,21 @@ SALOMEDS_AttributeComment::~SALOMEDS_AttributeComment()
 std::string SALOMEDS_AttributeComment::Value()
 {
   std::string aValue;
-  if(_isLocal) 
-    aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeComment)::DownCast(_local_impl)->Value()).ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeComment)::
+                                     DownCast(_local_impl)->Value()).ToCString();
+  }
   else aValue = SALOMEDS::AttributeComment::_narrow(_corba_impl)->Value();
   return aValue;
 }
  
 void SALOMEDS_AttributeComment::SetValue(const std::string& value)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeComment)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeComment)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+  }
   else SALOMEDS::AttributeComment::_narrow(_corba_impl)->SetValue(value.c_str());
 }
index ac1abc62b22e43e43dab0b53a69baad714190268..10d9c4df8866edc1ac7a3248a24800c5da07f103 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeDrawable.hxx"
+#include "SALOMEDS.hxx"
 
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
@@ -40,14 +41,20 @@ SALOMEDS_AttributeDrawable::~SALOMEDS_AttributeDrawable()
 bool SALOMEDS_AttributeDrawable::IsDrawable()
 {
   bool aValue;
-  if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_local_impl)->IsDrawable();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aValue = (bool)Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_local_impl)->IsDrawable();
+  }
   else aValue = SALOMEDS::AttributeDrawable::_narrow(_corba_impl)->IsDrawable();
   return aValue;
 }
+
 void SALOMEDS_AttributeDrawable::SetDrawable(bool value)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_local_impl)->SetDrawable((int)value);
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_local_impl)->SetDrawable((int)value);
+  }
   else SALOMEDS::AttributeDrawable::_narrow(_corba_impl)->SetDrawable(value);
 }
index 828b8add8322195fe31d9bbf4bac4febab614f53..e74b2221f25a68a360229d2c4f6ad0f81b68e450 100644 (file)
 
 using namespace std;
 
-CORBA::Boolean SALOMEDS_AttributeDrawable_i::IsDrawable() 
+CORBA::Boolean SALOMEDS_AttributeDrawable_i::IsDrawable()
 {
   SALOMEDS::Locker lock;
   return (Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_impl)->IsDrawable() == 1);
 }
-                                                           
-void SALOMEDS_AttributeDrawable_i::SetDrawable(CORBA::Boolean value) 
+
+void SALOMEDS_AttributeDrawable_i::SetDrawable(CORBA::Boolean value)
 {
   SALOMEDS::Locker lock;
   CheckLocked();
   Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_impl)->SetDrawable(value);
 }
-
index 4dce5430387bf6eeb4db8f83b12d74165ca823fc..4f14f10b4b864dc16e8c3e701da0a6d08b3c0623 100644 (file)
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeExpandable.hxx"
+#include "SALOMEDS.hxx"
 
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
 
-SALOMEDS_AttributeExpandable::SALOMEDS_AttributeExpandable(const Handle(SALOMEDSImpl_AttributeExpandable)& theAttr)
+SALOMEDS_AttributeExpandable::SALOMEDS_AttributeExpandable
+                  (const Handle(SALOMEDSImpl_AttributeExpandable)& theAttr)
 :SALOMEDS_GenericAttribute(theAttr)
 {}
 
@@ -40,14 +42,20 @@ SALOMEDS_AttributeExpandable::~SALOMEDS_AttributeExpandable()
 bool SALOMEDS_AttributeExpandable::IsExpandable()
 {
   bool aValue;
-  if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_local_impl)->IsExpandable();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aValue = (bool)Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_local_impl)->IsExpandable();
+  }
   else aValue = SALOMEDS::AttributeExpandable::_narrow(_corba_impl)->IsExpandable();
   return aValue;
 }
+
 void SALOMEDS_AttributeExpandable::SetExpandable(bool value)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_local_impl)->SetExpandable((int)value);
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_local_impl)->SetExpandable((int)value);
+  }
   else SALOMEDS::AttributeExpandable::_narrow(_corba_impl)->SetExpandable(value);
 }
index 257ab67a7aee0dfee583addc109694ffa0d73faa..e62b60c8ca3b7833ff0ddc7f33def89c2f7a41d2 100644 (file)
 
 using namespace std;
 
-CORBA::Boolean SALOMEDS_AttributeExpandable_i::IsExpandable() 
+CORBA::Boolean SALOMEDS_AttributeExpandable_i::IsExpandable()
 {
   SALOMEDS::Locker lock;
   return (Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_impl)->IsExpandable() == 1);
 }
-                                                           
-void SALOMEDS_AttributeExpandable_i::SetExpandable(CORBA::Boolean value) 
+
+void SALOMEDS_AttributeExpandable_i::SetExpandable(CORBA::Boolean value)
 {
   SALOMEDS::Locker lock;
   CheckLocked();
   Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_impl)->SetExpandable(value);
 }
-
index 2dc8a3c9cb2e42e324bfb43abbbcfb118ba2c10b..9ea935ffef0312fa0ded049ce5f1e9b9db6692d4 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeExternalFileDef.hxx"
+#include "SALOMEDS.hxx"
 
 #include <string>
 #include <TCollection_AsciiString.hxx> 
@@ -41,15 +42,21 @@ SALOMEDS_AttributeExternalFileDef::~SALOMEDS_AttributeExternalFileDef()
 std::string SALOMEDS_AttributeExternalFileDef::Value()
 {
   std::string aValue;
-  if(_isLocal) 
-   aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_local_impl)->Value()).ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
+    aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeExternalFileDef)::
+                                     DownCast(_local_impl)->Value()).ToCString();
+  }
   else aValue = SALOMEDS::AttributeExternalFileDef::_narrow(_corba_impl)->Value();
   return aValue;
 }
  
 void SALOMEDS_AttributeExternalFileDef::SetValue(const std::string& value)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+  }
   else SALOMEDS::AttributeExternalFileDef::_narrow(_corba_impl)->SetValue(value.c_str());
 }
index ed535426a0add697988f02df1165fe7fca78c8fc..797941a08829646ca54c13bc0dcb7c09c7dc0e74 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeFileType.hxx"
+#include "SALOMEDS.hxx"
 
 #include <string>
 #include <TCollection_AsciiString.hxx> 
@@ -41,15 +42,21 @@ SALOMEDS_AttributeFileType::~SALOMEDS_AttributeFileType()
 std::string SALOMEDS_AttributeFileType::Value()
 {
   std::string aValue;
-  if(_isLocal) 
-    aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_local_impl)->Value()).ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeFileType)::
+                                     DownCast(_local_impl)->Value()).ToCString();
+  }
   else aValue = SALOMEDS::AttributeFileType::_narrow(_corba_impl)->Value();
   return aValue;
 }
+
 void SALOMEDS_AttributeFileType::SetValue(const std::string& value)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+  }
   else SALOMEDS::AttributeFileType::_narrow(_corba_impl)->SetValue(value.c_str());
 }
index 5168f238b16dfe196c7ae98df77175c1e91cb35a..935a7edeee2ff471473083ac559b407d653e2e6f 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeFlags.hxx"
+#include "SALOMEDS.hxx"
 
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
@@ -40,14 +41,20 @@ SALOMEDS_AttributeFlags::~SALOMEDS_AttributeFlags()
 int SALOMEDS_AttributeFlags::GetFlags()
 {
   int aValue;
-  if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl)->Get();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aValue = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl)->Get();
+  }
   else aValue = SALOMEDS::AttributeFlags::_narrow(_corba_impl)->GetFlags();
   return aValue;
 }
 
 void SALOMEDS_AttributeFlags::SetFlags(int theFlags)
 {
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl)->Set(theFlags);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl)->Set(theFlags);
+  }
   else SALOMEDS::AttributeFlags::_narrow(_corba_impl)->SetFlags(theFlags);
 }
 
@@ -58,12 +65,13 @@ bool SALOMEDS_AttributeFlags::Get(int theFlag)
  
 void SALOMEDS_AttributeFlags::Set(int theFlag, bool theValue)
 {
-  if(_isLocal)  {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeFlags) anAttr = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl);
-    if ( theValue )
-      anAttr->Set( anAttr->Get() | theFlag );
+    if (theValue)
+      anAttr->Set(anAttr->Get() | theFlag);
     else
-      anAttr->Set( anAttr->Get() & ~theFlag );    
+      anAttr->Set(anAttr->Get() & ~theFlag);    
   }
   else SALOMEDS::AttributeFlags::_narrow(_corba_impl)->Set(theFlag, theValue);
 }
index e0dc038d9ed132ac21499c56894640d8d175b7fa..38b75427961fbd7323175facbf2198e3e8fd5729 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeGraphic.hxx"
+#include "SALOMEDS.hxx"
 
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
@@ -38,16 +39,22 @@ SALOMEDS_AttributeGraphic::~SALOMEDS_AttributeGraphic()
 {}
 
 
-bool SALOMEDS_AttributeGraphic:: GetVisibility(int theViewId)
+bool SALOMEDS_AttributeGraphic::GetVisibility(int theViewId)
 {
   bool aValue;
-  if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_local_impl)->GetVisibility(theViewId);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aValue = (bool)Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_local_impl)->GetVisibility(theViewId);
+  }
   else aValue = SALOMEDS::AttributeGraphic::_narrow(_corba_impl)->GetVisibility(theViewId);
   return aValue;
 }
+
 void SALOMEDS_AttributeGraphic::SetVisibility(int theViewId, bool theValue)
 {
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_local_impl)->SetVisibility(theViewId, theValue);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_local_impl)->SetVisibility(theViewId, theValue);
+  }
   else SALOMEDS::AttributeGraphic::_narrow(_corba_impl)->SetVisibility(theViewId, theValue);
 }
index de6ca253ff3c04d2c1c5827f611d223e18f8de19..04b37485abcafc75daa672f1377efeb486eba46e 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeIOR.hxx"
+#include "SALOMEDS.hxx"
 
 #include <string>
 #include <TCollection_AsciiString.hxx> 
@@ -41,15 +42,21 @@ SALOMEDS_AttributeIOR::~SALOMEDS_AttributeIOR()
 std::string SALOMEDS_AttributeIOR::Value()
 {
   std::string aValue;
-  if(_isLocal) 
-    aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_local_impl)->Value()).ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeIOR)::
+                                     DownCast(_local_impl)->Value()).ToCString();
+  }
   else aValue = SALOMEDS::AttributeIOR::_narrow(_corba_impl)->Value();
   return aValue;
 }
+
 void SALOMEDS_AttributeIOR::SetValue(const std::string& value)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+  }
   else SALOMEDS::AttributeIOR::_narrow(_corba_impl)->SetValue(value.c_str());
 }
index b32650bcdc5ffe0175268f0fbe48264d51edaedd..f7d4addfb5e9291a0ba35c966daa17443d28a11a 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeInteger.hxx"
+#include "SALOMEDS.hxx"
 
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
@@ -40,14 +41,20 @@ SALOMEDS_AttributeInteger::~SALOMEDS_AttributeInteger()
 int SALOMEDS_AttributeInteger::Value()
 {
   int aValue;
-  if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_local_impl)->Value();
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
+    aValue = Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_local_impl)->Value();
+  }
   else aValue = SALOMEDS::AttributeInteger::_narrow(_corba_impl)->Value();
   return aValue;
 }
+
 void SALOMEDS_AttributeInteger::SetValue(int value)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_local_impl)->SetValue(value);
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_local_impl)->SetValue(value);
+  }
   else SALOMEDS::AttributeInteger::_narrow(_corba_impl)->SetValue(value);
 }
index c9d778adb36a99e0efbfe9c788b5e279eb146cdf..379fc58b63312c653d774bcc3d8a7ecf275c260e 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeLocalID.hxx"
+#include "SALOMEDS.hxx"
 
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
@@ -40,14 +41,20 @@ SALOMEDS_AttributeLocalID::~SALOMEDS_AttributeLocalID()
 int SALOMEDS_AttributeLocalID::Value()
 {
   int aValue;
-  if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_local_impl)->Value();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aValue = (bool)Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_local_impl)->Value();
+  }
   else aValue = SALOMEDS::AttributeLocalID::_narrow(_corba_impl)->Value();
   return aValue;
 }
+
 void SALOMEDS_AttributeLocalID::SetValue(int value)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_local_impl)->SetValue(value);
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_local_impl)->SetValue(value);
+  }
   else SALOMEDS::AttributeLocalID::_narrow(_corba_impl)->SetValue(value);
 }
index b4b8d7b18b61e28e927b1af7d8f9f570a5a7cadc..1fc1a1a8a2b3e36d1bc0472b67a40cea623fdc95 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeName.hxx"
+#include "SALOMEDS.hxx"
 
 #include <string>
 #include <TCollection_AsciiString.hxx> 
@@ -41,15 +42,21 @@ SALOMEDS_AttributeName::~SALOMEDS_AttributeName()
 std::string SALOMEDS_AttributeName::Value()
 {
   std::string aValue;
-  if(_isLocal) 
-    aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeName)::DownCast(_local_impl)->Value()).ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
+    aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeName)::
+                                     DownCast(_local_impl)->Value()).ToCString();
+  }
   else aValue = SALOMEDS::AttributeName::_narrow(_corba_impl)->Value();
   return aValue;
 }
+
 void SALOMEDS_AttributeName::SetValue(const std::string& value)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeName)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeName)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+  }
   else SALOMEDS::AttributeName::_narrow(_corba_impl)->SetValue(value.c_str());
 }
index 7424a749871e9f38a93b890c6acc8ee69637ee12..a2c82dd8116ce67af36c5b36ae6ff9f6fa251ba7 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeOpened.hxx"
+#include "SALOMEDS.hxx"
 
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
@@ -40,13 +41,19 @@ SALOMEDS_AttributeOpened::~SALOMEDS_AttributeOpened()
 bool SALOMEDS_AttributeOpened::IsOpened()
 {
   bool aValue;
-  if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_local_impl)->IsOpened();
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
+    aValue = (bool)Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_local_impl)->IsOpened();
+  }
   else aValue = SALOMEDS::AttributeOpened::_narrow(_corba_impl)->IsOpened();
   return aValue;
 }
+
 void SALOMEDS_AttributeOpened::SetOpened(bool value)
 {
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_local_impl)->SetOpened((int)value);
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_local_impl)->SetOpened((int)value);
+  }
   else SALOMEDS::AttributeOpened::_narrow(_corba_impl)->SetOpened(value);
 }
index 1ca0bf276186a30d34f05e60ddfc7a112f1329fb..276cafe29e30d6e5588dfbe28d980b897c48c750 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributePersistentRef.hxx"
+#include "SALOMEDS.hxx"
 
 #include <string>
 #include <TCollection_AsciiString.hxx> 
@@ -41,15 +42,21 @@ SALOMEDS_AttributePersistentRef::~SALOMEDS_AttributePersistentRef()
 std::string SALOMEDS_AttributePersistentRef::Value()
 {
   std::string aValue;
-  if(_isLocal) 
-    aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_local_impl)->Value()).ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePersistentRef)::
+                                     DownCast(_local_impl)->Value()).ToCString();
+  }
   else aValue = SALOMEDS::AttributePersistentRef::_narrow(_corba_impl)->Value();
   return aValue;
 }
+
 void SALOMEDS_AttributePersistentRef::SetValue(const std::string& value)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+  }
   else SALOMEDS::AttributePersistentRef::_narrow(_corba_impl)->SetValue(value.c_str());
 }
index 21bf8a4892a0478d5c4cbddf84436ea9aecf606a..d82db803f53a03695b60f9305e5dc88552ee1fea 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributePixMap.hxx"
+#include "SALOMEDS.hxx"
 
 #include <string>
 #include <TCollection_AsciiString.hxx> 
@@ -41,7 +42,10 @@ SALOMEDS_AttributePixMap::~SALOMEDS_AttributePixMap()
 bool SALOMEDS_AttributePixMap::HasPixMap()
 {
   bool ret;
-  if(_isLocal) ret = Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_local_impl)->HasPixMap();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_local_impl)->HasPixMap();
+  }
   else ret = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->HasPixMap();
   return ret;
 }
@@ -49,15 +53,21 @@ bool SALOMEDS_AttributePixMap::HasPixMap()
 std::string SALOMEDS_AttributePixMap::GetPixMap()
 {
   std::string aValue;
-  if(_isLocal) 
-    aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_local_impl)->GetPixMap()).ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePixMap)::
+                                     DownCast(_local_impl)->GetPixMap()).ToCString();
+  }
   else aValue = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->GetPixMap();
   return aValue;
 }
+
 void SALOMEDS_AttributePixMap::SetPixMap(const std::string& value)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_local_impl)->SetPixMap((char*)value.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_local_impl)->SetPixMap((char*)value.c_str());
+  }
   else SALOMEDS::AttributePixMap::_narrow(_corba_impl)->SetPixMap(value.c_str());
 }
index 0c01c6e50ecac456a19ce4747f6a39a39898fc69..8ba8c973b384ae814694cedd0a6edb206f863b44 100644 (file)
 
 #include "SALOMEDS_AttributePixMap_i.hxx"
 #include "SALOMEDS.hxx"
+
 #include <TCollection_AsciiString.hxx>
 
 using namespace std;
 
-CORBA::Boolean SALOMEDS_AttributePixMap_i::HasPixMap() 
+CORBA::Boolean SALOMEDS_AttributePixMap_i::HasPixMap()
 {
+  SALOMEDS::Locker lock;
   return Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->HasPixMap();
 }
 
-char* SALOMEDS_AttributePixMap_i::GetPixMap() 
+char* SALOMEDS_AttributePixMap_i::GetPixMap()
 {
   SALOMEDS::Locker lock;
-  CORBA::String_var S = 
-    CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->GetPixMap()).ToCString());
+  CORBA::String_var S =
+    CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePixMap)::
+                                              DownCast(_impl)->GetPixMap()).ToCString());
   return S._retn();
 }
 
-void SALOMEDS_AttributePixMap_i::SetPixMap(const char* value) 
+void SALOMEDS_AttributePixMap_i::SetPixMap(const char* value)
 {
   SALOMEDS::Locker lock;
   CheckLocked();
   CORBA::String_var Str = CORBA::string_dup(value);
   Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->SetPixMap(TCollection_ExtendedString(Str));
 }
-
index 71990e4db97ca5287ac73ee138ea2d6a2a37e0fa..789dd361812f4d1c2667e976b697adafa68a956c 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributePythonObject.hxx"
+#include "SALOMEDS.hxx"
 
 #include <string>
 #include <TCollection_AsciiString.hxx> 
@@ -41,7 +42,10 @@ SALOMEDS_AttributePythonObject::~SALOMEDS_AttributePythonObject()
 bool SALOMEDS_AttributePythonObject::IsScript()
 {
   bool ret;
-  if(_isLocal) ret = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_local_impl)->IsScript();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_local_impl)->IsScript();
+  }
   else ret = SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->IsScript();
   return ret;
 }
@@ -49,15 +53,22 @@ bool SALOMEDS_AttributePythonObject::IsScript()
 std::string SALOMEDS_AttributePythonObject::GetObject()
 {
   std::string aValue;
-  if(_isLocal) 
-    aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_local_impl)->GetObject()).ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePythonObject)::
+                                     DownCast(_local_impl)->GetObject()).ToCString();
+  }
   else aValue = SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->GetObject();
   return aValue;
 }
+
 void SALOMEDS_AttributePythonObject::SetObject(const std::string& theSequence, bool IsScript)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_local_impl)->SetObject((char*)theSequence.c_str(), IsScript);
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributePythonObject)::
+      DownCast(_local_impl)->SetObject((char*)theSequence.c_str(), IsScript);
+  }
   else SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->SetObject(theSequence.c_str(), IsScript);
 }
index 8d98f6cf120ed2d4fec1d7fe74db63f8e57f8418..e96837534101e2b4bc81915bae99ccd9db1146e6 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeReal.hxx"
+#include "SALOMEDS.hxx"
 
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
@@ -40,14 +41,20 @@ SALOMEDS_AttributeReal::~SALOMEDS_AttributeReal()
 double SALOMEDS_AttributeReal::Value()
 {
   double aValue;
-  if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeReal)::DownCast(_local_impl)->Value();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aValue = Handle(SALOMEDSImpl_AttributeReal)::DownCast(_local_impl)->Value();
+  }
   else aValue = SALOMEDS::AttributeReal::_narrow(_corba_impl)->Value();
   return aValue;
 }
+
 void SALOMEDS_AttributeReal::SetValue(double value)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeReal)::DownCast(_local_impl)->SetValue(value);
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeReal)::DownCast(_local_impl)->SetValue(value);
+  }
   else SALOMEDS::AttributeReal::_narrow(_corba_impl)->SetValue(value);
 }
index 6ffb270f7fd32e33a0ae84d336436dfe6ed75d2c..fb16c9907c38299b727ba343d499a76c1aa3da07 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeSelectable.hxx"
+#include "SALOMEDS.hxx"
 
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
@@ -40,13 +41,19 @@ SALOMEDS_AttributeSelectable::~SALOMEDS_AttributeSelectable()
 bool SALOMEDS_AttributeSelectable::IsSelectable()
 {
   bool aValue;
-  if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_local_impl)->IsSelectable();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aValue = (bool)Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_local_impl)->IsSelectable();
+  }
   else aValue = SALOMEDS::AttributeSelectable::_narrow(_corba_impl)->IsSelectable();
   return aValue;
 }
+
 void SALOMEDS_AttributeSelectable::SetSelectable(bool value)
 {
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_local_impl)->SetSelectable((int)value);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_local_impl)->SetSelectable((int)value);
+  }
   else SALOMEDS::AttributeSelectable::_narrow(_corba_impl)->SetSelectable(value);
 }
index fac549e3be2c4b9c97d01c67683e91b59c6e331c..a2d8613122d31ff5182a3b32f4415e06d41fb4ee 100644 (file)
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeSequenceOfInteger.hxx"
+#include "SALOMEDS.hxx"
 
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
 #include <TColStd_HSequenceOfInteger.hxx>
 
-SALOMEDS_AttributeSequenceOfInteger
-::SALOMEDS_AttributeSequenceOfInteger(const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr)
+SALOMEDS_AttributeSequenceOfInteger::SALOMEDS_AttributeSequenceOfInteger
+                  (const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr)
 :SALOMEDS_GenericAttribute(theAttr)
 {}
 
-SALOMEDS_AttributeSequenceOfInteger::SALOMEDS_AttributeSequenceOfInteger(SALOMEDS::AttributeSequenceOfInteger_ptr theAttr)
+SALOMEDS_AttributeSequenceOfInteger::SALOMEDS_AttributeSequenceOfInteger
+                  (SALOMEDS::AttributeSequenceOfInteger_ptr theAttr)
 :SALOMEDS_GenericAttribute(theAttr)
 {}
 
@@ -42,15 +44,17 @@ SALOMEDS_AttributeSequenceOfInteger::~SALOMEDS_AttributeSequenceOfInteger()
 void SALOMEDS_AttributeSequenceOfInteger::Assign(const std::vector<int>& other)
 {
   int i, aLength = other.size();
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
-    for(i = 0; i < aLength; i++) aSeq->Append(other[i]);
+    for (i = 0; i < aLength; i++) aSeq->Append(other[i]);
     Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Assign(aSeq);
   }
   else {
     SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq();
     aSeq->length(aLength);
-    for(i = 0; i < aLength; i++) aSeq[i] = other[i];
+    for (i = 0; i < aLength; i++) aSeq[i] = other[i];
     SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Assign(aSeq);
   }
 }
@@ -59,50 +63,70 @@ std::vector<int> SALOMEDS_AttributeSequenceOfInteger::CorbaSequence()
 {
   std::vector<int> aVector;
   int i, aLength;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeSequenceOfInteger) aSeqAttr;
     aSeqAttr = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl);
     aLength = aSeqAttr->Length();
-    for(i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
+    for (i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
   }
   else {
-    SALOMEDS::AttributeSequenceOfInteger_var aSeqAttr = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl);
+    SALOMEDS::AttributeSequenceOfInteger_var aSeqAttr =
+      SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl);
     aLength = aSeqAttr->Length();
-    for(i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
+    for (i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
   }
   return aVector;
 }
+
 void SALOMEDS_AttributeSequenceOfInteger::Add(int value)
 {
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Add(value);
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Add(value);
+  }
   else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Add(value);
 }
 
 void SALOMEDS_AttributeSequenceOfInteger::Remove(int index)
 {
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Remove(index);
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Remove(index);
+  }
   else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Remove(index);
 }
+
 void SALOMEDS_AttributeSequenceOfInteger::ChangeValue(int index, int value)
 {
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->ChangeValue(index, value);
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->ChangeValue(index, value);
+  }
   else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->ChangeValue(index, value);
 }
+
 int SALOMEDS_AttributeSequenceOfInteger::Value(int index)
 {
   int aValue;
-  if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Value(index);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aValue = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Value(index);
+  }
   else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Value(index);
   return aValue;
 }
+
 int SALOMEDS_AttributeSequenceOfInteger::Length()
 {
   int aValue;
-  if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)-> Length();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aValue = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)-> Length();
+  }
   else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)-> Length();
   return aValue;
 }
index faffcaa29b3f67c0605b75774fd20f3464cf8c91..9697594f8c49e0c9314d6febace9fd4becec004f 100644 (file)
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeSequenceOfReal.hxx"
+#include "SALOMEDS.hxx"
 
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
 #include <TColStd_HSequenceOfReal.hxx>
 
-SALOMEDS_AttributeSequenceOfReal
-::SALOMEDS_AttributeSequenceOfReal(const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr)
+SALOMEDS_AttributeSequenceOfReal::SALOMEDS_AttributeSequenceOfReal
+                  (const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr)
 :SALOMEDS_GenericAttribute(theAttr)
 {}
 
-SALOMEDS_AttributeSequenceOfReal::SALOMEDS_AttributeSequenceOfReal(SALOMEDS::AttributeSequenceOfReal_ptr theAttr)
+SALOMEDS_AttributeSequenceOfReal::SALOMEDS_AttributeSequenceOfReal
+                  (SALOMEDS::AttributeSequenceOfReal_ptr theAttr)
 :SALOMEDS_GenericAttribute(theAttr)
 {}
 
@@ -42,15 +44,17 @@ SALOMEDS_AttributeSequenceOfReal::~SALOMEDS_AttributeSequenceOfReal()
 void SALOMEDS_AttributeSequenceOfReal::Assign(const std::vector<double>& other)
 {
   int i, aLength = other.size();
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock; 
     Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal;
-    for(i = 0; i < aLength; i++) aSeq->Append(other[i]);
+    for (i = 0; i < aLength; i++) aSeq->Append(other[i]);
     Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Assign(aSeq);
   }
   else {
     SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq();
     aSeq->length(aLength);
-    for(i = 0; i < aLength; i++) aSeq[i] = other[i];
+    for (i = 0; i < aLength; i++) aSeq[i] = other[i];
     SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Assign(aSeq);
   }
 }
@@ -59,50 +63,69 @@ std::vector<double> SALOMEDS_AttributeSequenceOfReal::CorbaSequence()
 {
   std::vector<double> aVector;
   int i, aLength;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
     Handle(SALOMEDSImpl_AttributeSequenceOfReal) aSeqAttr;
     aSeqAttr = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl);
     aLength = aSeqAttr->Length();
-    for(i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
+    for (i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
   }
   else {
     SALOMEDS::AttributeSequenceOfReal_var aSeqAttr = SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl);
     aLength = aSeqAttr->Length();
-    for(i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
+    for (i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
   }
   return aVector;
 }
+
 void SALOMEDS_AttributeSequenceOfReal::Add(double value)
 {
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Add(value);
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Add(value);
+  }
   else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Add(value);
 }
 
 void SALOMEDS_AttributeSequenceOfReal::Remove(int index)
 {
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Remove(index);
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Remove(index);
+  }
   else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Remove(index);
 }
+
 void SALOMEDS_AttributeSequenceOfReal::ChangeValue(int index, double value)
 {
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->ChangeValue(index, value);
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->ChangeValue(index, value);
+  }
   else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->ChangeValue(index, value);
 }
+
 double SALOMEDS_AttributeSequenceOfReal::Value(int index)
 {
   double aValue;
-  if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Value(index);
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
+    aValue = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Value(index);
+  }
   else aValue = SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Value(index);
   return aValue;
 }
+
 int SALOMEDS_AttributeSequenceOfReal::Length()
 {
   int aValue;
-  if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)-> Length();
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
+    aValue = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)-> Length();
+  }
   else aValue = SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)-> Length();
   return aValue;
 }
index 8447a28dd4c3ef61f9a0f2592c9f763cf750cbb9..b56a728b1176a4c0552fc7dbba9b9ea8c7c97245 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeStudyProperties.hxx"
+#include "SALOMEDS.hxx"
 
 #include <string>
 #include <TCollection_AsciiString.hxx>
@@ -46,6 +47,8 @@ SALOMEDS_AttributeStudyProperties::~SALOMEDS_AttributeStudyProperties()
 void SALOMEDS_AttributeStudyProperties::SetUserName(const std::string& theName)
 {
   if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl =
       Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl);
     anImpl->ChangeCreatorName((char*)theName.c_str());
@@ -57,6 +60,7 @@ std::string SALOMEDS_AttributeStudyProperties::GetUserName()
 {
   std::string aName;
   if (_isLocal) {
+    SALOMEDS::Locker lock;
     TCollection_ExtendedString S =
       Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreatorName();
     aName = TCollection_AsciiString(S).ToCString();
@@ -73,6 +77,8 @@ void SALOMEDS_AttributeStudyProperties::SetCreationDate
               (int theMinute, int theHour, int theDay, int theMonth, int theYear)
 {
   if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl =
       Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl);
     int aTmp;
@@ -96,6 +102,7 @@ bool SALOMEDS_AttributeStudyProperties::GetCreationDate(int& theMinute,
 {
   bool ret;
   if (_isLocal) {
+    SALOMEDS::Locker lock;
     ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast
       (_local_impl)->GetCreationDate(theMinute, theHour, theDay, theMonth, theYear);
   } else {
@@ -117,6 +124,8 @@ bool SALOMEDS_AttributeStudyProperties::GetCreationDate(int& theMinute,
 void SALOMEDS_AttributeStudyProperties::SetCreationMode(const std::string& theMode)
 {
   if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     if (theMode == "from scratch")
       Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(1);
     else if (theMode == "copy from")
@@ -131,6 +140,7 @@ std::string SALOMEDS_AttributeStudyProperties::GetCreationMode()
 {
   std::string aMode;
   if (_isLocal) {
+    SALOMEDS::Locker lock;
     int mode  = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreationMode();
     if (mode == 1) aMode = "from scratch";
     if (mode == 2) aMode = "copy from";
@@ -142,8 +152,10 @@ std::string SALOMEDS_AttributeStudyProperties::GetCreationMode()
 
 void SALOMEDS_AttributeStudyProperties::SetModified(int theModified)
 {
-  if (_isLocal)
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetModified(theModified);
+  }
   else
     SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModified(theModified);
 }
@@ -151,8 +163,10 @@ void SALOMEDS_AttributeStudyProperties::SetModified(int theModified)
 bool SALOMEDS_AttributeStudyProperties::IsModified()
 {
   bool ret;
-  if (_isLocal)
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsModified();
+  }
   else
     ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsModified();
   return ret;
@@ -161,8 +175,10 @@ bool SALOMEDS_AttributeStudyProperties::IsModified()
 int SALOMEDS_AttributeStudyProperties::GetModified()
 {
   int isModified;
-  if (_isLocal)
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     isModified = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetModified();
+  }
   else
     isModified = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModified();
   return isModified;
@@ -170,8 +186,10 @@ int SALOMEDS_AttributeStudyProperties::GetModified()
 
 void SALOMEDS_AttributeStudyProperties::SetLocked(bool theLocked)
 {
-  if (_isLocal)
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetLocked(theLocked);
+  }
   else
     SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetLocked(theLocked);
 }
@@ -179,8 +197,10 @@ void SALOMEDS_AttributeStudyProperties::SetLocked(bool theLocked)
 bool SALOMEDS_AttributeStudyProperties::IsLocked()
 {
   bool ret;
-  if (_isLocal)
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsLocked();
+  }
   else
     ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsLocked();
   return ret;
@@ -194,6 +214,8 @@ void SALOMEDS_AttributeStudyProperties::SetModification(const std::string& theNa
                                                        int theYear)
 {
   if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl =
       Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl);
     anImpl->SetModification((char*)theName.c_str(), theMinute, theHour, theDay, theMonth, theYear);
@@ -217,6 +239,7 @@ void SALOMEDS_AttributeStudyProperties::GetModificationsList(std::vector<std::st
   int i, aLength;
 
   if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfExtendedString) aNames;
     Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
     Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl =
index d25dd7854b50df3977e79c2b11d612c118dd59f4..4d8bb55464cebb0028226952e330dd135c3afab1 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeTableOfInteger.hxx"
+#include "SALOMEDS.hxx"
 
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
 #include <TColStd_HSequenceOfExtendedString.hxx>
 
 
-SALOMEDS_AttributeTableOfInteger
-::SALOMEDS_AttributeTableOfInteger(const Handle(SALOMEDSImpl_AttributeTableOfInteger)& theAttr)
+SALOMEDS_AttributeTableOfInteger::SALOMEDS_AttributeTableOfInteger
+                  (const Handle(SALOMEDSImpl_AttributeTableOfInteger)& theAttr)
 :SALOMEDS_GenericAttribute(theAttr)
 {}
 
-SALOMEDS_AttributeTableOfInteger::SALOMEDS_AttributeTableOfInteger(SALOMEDS::AttributeTableOfInteger_ptr theAttr)
+SALOMEDS_AttributeTableOfInteger::SALOMEDS_AttributeTableOfInteger
+                  (SALOMEDS::AttributeTableOfInteger_ptr theAttr)
 :SALOMEDS_GenericAttribute(theAttr)
 {}
 
@@ -44,35 +46,45 @@ SALOMEDS_AttributeTableOfInteger::~SALOMEDS_AttributeTableOfInteger()
 
 void SALOMEDS_AttributeTableOfInteger::SetTitle(const std::string& theTitle)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str());
+  }
   else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetTitle(theTitle.c_str());
 }
 
 std::string SALOMEDS_AttributeTableOfInteger::GetTitle()
 {
   std::string aStr;
-  if(_isLocal) 
-    aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetTitle()).ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfInteger)::
+                                   DownCast(_local_impl)->GetTitle()).ToCString();
+  }
   else aStr = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetTitle();
   return aStr;
 }
 
 void SALOMEDS_AttributeTableOfInteger::SetRowTitle(int theIndex, const std::string& theTitle)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetRowTitle(theIndex, 
-                                                                                               (char*)theTitle.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTableOfInteger)::
+      DownCast(_local_impl)->SetRowTitle(theIndex, (char*)theTitle.c_str());
+  }
   else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowTitle(theIndex, theTitle.c_str());
 }
 
 void SALOMEDS_AttributeTableOfInteger::SetRowTitles(const std::vector<std::string>& theTitles)
 {
-  CheckLocked();
   int aLength = theTitles.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
-    for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
+    for (i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
     Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetRowTitles(aSeq);
   }
   else {
@@ -88,7 +100,8 @@ std::vector<std::string> SALOMEDS_AttributeTableOfInteger::GetRowTitles()
 {
   std::vector<std::string> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfExtendedString) aSeq;
     aSeq = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetRowTitles();
     aLength = aSeq->Length();
@@ -104,26 +117,29 @@ std::vector<std::string> SALOMEDS_AttributeTableOfInteger::GetRowTitles()
 
 void SALOMEDS_AttributeTableOfInteger::SetColumnTitle(int theIndex, const std::string& theTitle)
 {
-  CheckLocked();
-  if(_isLocal) 
-    Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetColumnTitle(theIndex, 
-                                                                                       (char*)theTitle.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTableOfInteger)::
+      DownCast(_local_impl)->SetColumnTitle(theIndex, (char*)theTitle.c_str());
+  }
   else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetColumnTitle(theIndex, theTitle.c_str());
 }
 
 void SALOMEDS_AttributeTableOfInteger::SetColumnTitles(const std::vector<std::string>& theTitles)
 {
-  CheckLocked();
   int aLength = theTitles.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
-    for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
+    for (i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
     Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetColumnTitles(aSeq);
   }
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for(i = 0; i < aLength; i++) aSeq[i] = theTitles[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = theTitles[i].c_str();
     SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetColumnTitles(aSeq);
   }
 }
@@ -132,41 +148,46 @@ std::vector<std::string> SALOMEDS_AttributeTableOfInteger::GetColumnTitles()
 {
   std::vector<std::string> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfExtendedString) aSeq;
     aSeq = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetColumnTitles();
     aLength = aSeq->Length();
-    for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+    for (i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
   }
   else {
     SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetColumnTitles();
     aLength = aSeq->length();
-    for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+    for (i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
   }
   return aVector;
 }
 
 void SALOMEDS_AttributeTableOfInteger::SetRowUnit(int theIndex, const std::string& theUnit)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetRowUnit(theIndex, 
-                                                                                              (char*)theUnit.c_str()); 
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTableOfInteger)::
+      DownCast(_local_impl)->SetRowUnit(theIndex, (char*)theUnit.c_str());
+  }
   else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowUnit(theIndex, theUnit.c_str());
 }
 
 void SALOMEDS_AttributeTableOfInteger::SetRowUnits(const std::vector<std::string>& theUnits)
 {
-  CheckLocked();
   int aLength = theUnits.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
-    for(i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str());
+    for (i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str());
     Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetRowUnits(aSeq);
   }
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for(i = 0; i < aLength; i++) aSeq[i] = (char*)theUnits[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theUnits[i].c_str();
     SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowUnits(aSeq);
   }
 }
@@ -175,16 +196,17 @@ std::vector<std::string> SALOMEDS_AttributeTableOfInteger::GetRowUnits()
 {
   std::vector<std::string> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfExtendedString) aSeq;
     aSeq = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetRowUnits();
     aLength = aSeq->Length();
-    for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+    for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
   }
   else {
     SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowUnits();
     aLength = aSeq->length();
-    for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+    for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in());
   }
   return aVector;
 }
@@ -192,7 +214,10 @@ std::vector<std::string> SALOMEDS_AttributeTableOfInteger::GetRowUnits()
 int SALOMEDS_AttributeTableOfInteger::GetNbRows()
 {
   int aNb;
-  if(_isLocal) aNb = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetNbRows();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aNb = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetNbRows();
+  }
   else aNb = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetNbRows();
   return aNb;
 }
@@ -200,7 +225,10 @@ int SALOMEDS_AttributeTableOfInteger::GetNbRows()
 int SALOMEDS_AttributeTableOfInteger::GetNbColumns()
 {  
   int aNb;
-  if(_isLocal) aNb = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetNbColumns();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aNb = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetNbColumns();
+  }
   else aNb = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetNbColumns();
   return aNb;
   
@@ -208,9 +236,10 @@ int SALOMEDS_AttributeTableOfInteger::GetNbColumns()
 
 void SALOMEDS_AttributeTableOfInteger::AddRow(const std::vector<int>& theData)
 {
-  CheckLocked();
   int aLength = theData.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable;
     aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl);
     Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger;
@@ -232,9 +261,10 @@ void SALOMEDS_AttributeTableOfInteger::AddRow(const std::vector<int>& theData)
 
 void SALOMEDS_AttributeTableOfInteger::SetRow(int theRow, const std::vector<int>& theData)
 {
-  CheckLocked();
   int aLength = theData.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable;
     aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl);
     Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger;
@@ -249,7 +279,7 @@ void SALOMEDS_AttributeTableOfInteger::SetRow(int theRow, const std::vector<int>
   else {
     SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq();
     aSeq->length(aLength);
-    for(i = 0; i < aLength; i++) aSeq[i] = theData[i];
+    for (i = 0; i < aLength; i++) aSeq[i] = theData[i];
     SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRow(theRow, aSeq);
   }
 }
@@ -258,15 +288,16 @@ std::vector<int> SALOMEDS_AttributeTableOfInteger::GetRow(int theRow)
 {
   std::vector<int> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfInteger) aRow; 
     aRow = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetRowData(theRow);
     aLength = aRow->Length();
-    for(i = 1; i<= aLength; i++) aVector.push_back(aRow->Value(i));
+    for (i = 1; i <= aLength; i++) aVector.push_back(aRow->Value(i));
   }
   else {
     SALOMEDS::LongSeq_var aRow = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRow(theRow);
-    for(i = 0; i < aLength; i++) aVector.push_back(aRow[i]);
+    for (i = 0; i < aLength; i++) aVector.push_back(aRow[i]);
   }
 
   return aVector;
@@ -274,9 +305,10 @@ std::vector<int> SALOMEDS_AttributeTableOfInteger::GetRow(int theRow)
 
 void SALOMEDS_AttributeTableOfInteger::AddColumn(const std::vector<int>& theData)
 {
-  CheckLocked();
   int aLength = theData.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable;
     aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl);
     Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger;
@@ -298,9 +330,10 @@ void SALOMEDS_AttributeTableOfInteger::AddColumn(const std::vector<int>& theData
 
 void SALOMEDS_AttributeTableOfInteger::SetColumn(int theColumn, const std::vector<int>& theData)
 {
-  CheckLocked();
   int aLength = theData.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable;
     aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl);
     Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger;
@@ -315,7 +348,7 @@ void SALOMEDS_AttributeTableOfInteger::SetColumn(int theColumn, const std::vecto
   else {
     SALOMEDS::LongSeq_var aColumn = new SALOMEDS::LongSeq();
     aColumn->length(aLength);
-    for(i = 0; i < aLength; i++) aColumn[i] = theData[i];
+    for (i = 0; i < aLength; i++) aColumn[i] = theData[i];
     SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRow(theColumn, aColumn);
   }
 }
@@ -324,26 +357,29 @@ std::vector<int> SALOMEDS_AttributeTableOfInteger::GetColumn(int theColumn)
 {
   std::vector<int> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfInteger) aColumn; 
     aColumn = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetColumnData(theColumn);
     aLength = aColumn->Length();
-    for(i = 1; i<= aLength; i++) aVector.push_back(aColumn->Value(i));
+    for (i = 1; i <= aLength; i++) aVector.push_back(aColumn->Value(i));
   }
   else {
     SALOMEDS::LongSeq_var aColumn = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetColumn(theColumn);
-    for(i = 0; i < aLength; i++) aVector.push_back(aColumn[i]);
+    for (i = 0; i < aLength; i++) aVector.push_back(aColumn[i]);
   }
   return aVector;
 }
 
 void SALOMEDS_AttributeTableOfInteger::PutValue(int theValue, int theRow, int theColumn)
 {
-  CheckLocked();
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     try {
-      Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->PutValue(theValue, theRow, theColumn);
-    }   
+      Handle(SALOMEDSImpl_AttributeTableOfInteger)::
+        DownCast(_local_impl)->PutValue(theValue, theRow, theColumn);
+    }
     catch(...) {
       throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
     }
@@ -356,7 +392,10 @@ void SALOMEDS_AttributeTableOfInteger::PutValue(int theValue, int theRow, int th
 bool SALOMEDS_AttributeTableOfInteger::HasValue(int theRow, int theColumn)
 {
   bool ret;
-  if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->HasValue(theRow, theColumn);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->HasValue(theRow, theColumn);
+  }
   else ret = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->HasValue(theRow, theColumn);
   return ret;
 }
@@ -364,9 +403,11 @@ bool SALOMEDS_AttributeTableOfInteger::HasValue(int theRow, int theColumn)
 int SALOMEDS_AttributeTableOfInteger::GetValue(int theRow, int theColumn)
 {
   int aValue;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     try {
-      aValue = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetValue(theRow, theColumn);
+      aValue = Handle(SALOMEDSImpl_AttributeTableOfInteger)::
+        DownCast(_local_impl)->GetValue(theRow, theColumn);
     }   
     catch(...) {
       throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
@@ -382,21 +423,26 @@ std::vector<int> SALOMEDS_AttributeTableOfInteger::GetRowSetIndices(int theRow)
 {
   std::vector<int> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfInteger) aSet; 
     aSet = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetSetRowIndices(theRow);
     aLength = aSet->Length();
-    for(i = 1; i<= aLength; i++) aVector.push_back(aSet->Value(i));
+    for (i = 1; i <= aLength; i++) aVector.push_back(aSet->Value(i));
   }
   else {
-    SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowSetIndices(theRow);
-    for(i = 0; i < aLength; i++) aVector.push_back(aSet[i]);
+    SALOMEDS::LongSeq_var aSet =
+      SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowSetIndices(theRow);
+    for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]);
   }
   return aVector;
 }
 
 void SALOMEDS_AttributeTableOfInteger::SetNbColumns(int theNbColumns)
 {
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetNbColumns(theNbColumns);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetNbColumns(theNbColumns);
+  }
   else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetNbColumns(theNbColumns);
 }
index 68ccc2d428e9fdc581c990bed141774e0ca5c097..bb7cf1f26a0772eef615f41afa0deb4dd086759d 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeTableOfReal.hxx"
+#include "SALOMEDS.hxx"
 
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
@@ -30,8 +31,8 @@
 #include <TColStd_HSequenceOfExtendedString.hxx>
 
 
-SALOMEDS_AttributeTableOfReal
-::SALOMEDS_AttributeTableOfReal(const Handle(SALOMEDSImpl_AttributeTableOfReal)& theAttr)
+SALOMEDS_AttributeTableOfReal::SALOMEDS_AttributeTableOfReal
+                  (const Handle(SALOMEDSImpl_AttributeTableOfReal)& theAttr)
 :SALOMEDS_GenericAttribute(theAttr)
 {}
 
@@ -45,25 +46,34 @@ SALOMEDS_AttributeTableOfReal::~SALOMEDS_AttributeTableOfReal()
 
 void SALOMEDS_AttributeTableOfReal::SetTitle(const std::string& theTitle)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;     
+    Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str());
+  }
   else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetTitle(theTitle.c_str());
 }
 
 std::string SALOMEDS_AttributeTableOfReal::GetTitle()
 {
   std::string aStr;
-  if(_isLocal) 
-    aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetTitle()).ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
+    aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfReal)::
+                                   DownCast(_local_impl)->GetTitle()).ToCString();
+  }
   else aStr = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetTitle();
   return aStr;
 }
 
 void SALOMEDS_AttributeTableOfReal::SetRowTitle(int theIndex, const std::string& theTitle)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetRowTitle(theIndex, 
-                                                                                            (char*)theTitle.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;     
+    Handle(SALOMEDSImpl_AttributeTableOfReal)::
+      DownCast(_local_impl)->SetRowTitle(theIndex, (char*)theTitle.c_str());
+  }
   else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowTitle(theIndex, theTitle.c_str());
 }
 
@@ -71,59 +81,65 @@ void SALOMEDS_AttributeTableOfReal::SetRowTitles(const std::vector<std::string>&
 {
   CheckLocked();
   int aLength = theTitles.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;     
     Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
-    for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
+    for (i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
     Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetRowTitles(aSeq);
   }
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for(i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str();
     SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowTitles(aSeq);
   }
-  
 }
 
 std::vector<std::string> SALOMEDS_AttributeTableOfReal::GetRowTitles()
 {
   std::vector<std::string> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
     Handle(TColStd_HSequenceOfExtendedString) aSeq;
     aSeq = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetRowTitles();
     aLength = aSeq->Length();
-    for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+    for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
   }
   else {
     SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowTitles();
     aLength = aSeq->length();
-    for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+    for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in());
   }
   return aVector;
 }
 
 void SALOMEDS_AttributeTableOfReal::SetColumnTitle(int theIndex, const std::string& theTitle)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetColumnTitle(theIndex, 
-                                                                                               (char*)theTitle.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeTableOfReal)::
+      DownCast(_local_impl)->SetColumnTitle(theIndex, (char*)theTitle.c_str());
+  }
   else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetColumnTitle(theIndex, theTitle.c_str());
 }
 
 void SALOMEDS_AttributeTableOfReal::SetColumnTitles(const std::vector<std::string>& theTitles)
 {
-  CheckLocked();
   int aLength = theTitles.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock; 
     Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
-    for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
+    for (i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
     Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetColumnTitles(aSeq);
   }
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for(i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str();
     SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetColumnTitles(aSeq);
   }
 }
@@ -132,41 +148,46 @@ std::vector<std::string> SALOMEDS_AttributeTableOfReal::GetColumnTitles()
 {
   std::vector<std::string> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
     Handle(TColStd_HSequenceOfExtendedString) aSeq;
     aSeq = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetColumnTitles();
     aLength = aSeq->Length();
-    for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+    for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
   }
   else {
     SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetColumnTitles();
     aLength = aSeq->length();
-    for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+    for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in());
   }
   return aVector;
 }
 
 void SALOMEDS_AttributeTableOfReal::SetRowUnit(int theIndex, const std::string& theUnit)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetRowUnit(theIndex, 
-                                                                                           (char*)theUnit.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeTableOfReal)::
+      DownCast(_local_impl)->SetRowUnit(theIndex, (char*)theUnit.c_str());
+  }
   else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowUnit(theIndex, theUnit.c_str());
 }
 
 void SALOMEDS_AttributeTableOfReal::SetRowUnits(const std::vector<std::string>& theUnits)
 {
-  CheckLocked();
   int aLength = theUnits.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock; 
     Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
-    for(i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str());
+    for (i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str());
     Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetRowUnits(aSeq);
   }
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for(i = 0; i < aLength; i++) aSeq[i] = (char*)theUnits[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theUnits[i].c_str();
     SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowUnits(aSeq);
   }
 }
@@ -175,16 +196,17 @@ std::vector<std::string> SALOMEDS_AttributeTableOfReal::GetRowUnits()
 {
   std::vector<std::string> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
     Handle(TColStd_HSequenceOfExtendedString) aSeq;
     aSeq = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetRowUnits();
     aLength = aSeq->Length();
-    for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+    for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
   }
   else {
     SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowUnits();
     aLength = aSeq->length();
-    for(i = 0; i<aLength; i++) aVector.push_back(TCollection_AsciiString((char*)aSeq[i].in()).ToCString());
+    for (i = 0; i < aLength; i++) aVector.push_back(TCollection_AsciiString((char*)aSeq[i].in()).ToCString());
   }
   return aVector;
 }
@@ -192,7 +214,10 @@ std::vector<std::string> SALOMEDS_AttributeTableOfReal::GetRowUnits()
 int SALOMEDS_AttributeTableOfReal::GetNbRows()
 {
   int aNb;
-  if(_isLocal) aNb = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetNbRows();
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
+    aNb = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetNbRows();
+  }
   else aNb = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetNbRows();
   return aNb;
 }
@@ -200,17 +225,20 @@ int SALOMEDS_AttributeTableOfReal::GetNbRows()
 int SALOMEDS_AttributeTableOfReal::GetNbColumns()
 {  
   int aNb;
-  if(_isLocal) aNb = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetNbColumns();
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
+    aNb = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetNbColumns();
+  }
   else aNb = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetNbColumns();
   return aNb;
-  
 }
 
 void SALOMEDS_AttributeTableOfReal::AddRow(const std::vector<double>& theData)
 {
-  CheckLocked();
   int aLength = theData.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock; 
     Handle(SALOMEDSImpl_AttributeTableOfReal) aTable;
     aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl);
     Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal;
@@ -225,16 +253,17 @@ void SALOMEDS_AttributeTableOfReal::AddRow(const std::vector<double>& theData)
   else {
     SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq();
     aSeq->length(aLength);
-    for(i = 0; i < aLength; i++) aSeq[i] = theData[i];
+    for (i = 0; i < aLength; i++) aSeq[i] = theData[i];
     SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->AddRow(aSeq);
   }
 }
 
 void SALOMEDS_AttributeTableOfReal::SetRow(int theRow, const std::vector<double>& theData)
 {
-  CheckLocked();
   int aLength = theData.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock; 
     Handle(SALOMEDSImpl_AttributeTableOfReal) aTable;
     aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl);
     Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal;
@@ -249,7 +278,7 @@ void SALOMEDS_AttributeTableOfReal::SetRow(int theRow, const std::vector<double>
   else {
     SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq();
     aSeq->length(aLength);
-    for(i = 0; i < aLength; i++) aSeq[i] = theData[i];
+    for (i = 0; i < aLength; i++) aSeq[i] = theData[i];
     SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRow(theRow, aSeq);
   }
 }
@@ -258,15 +287,16 @@ std::vector<double> SALOMEDS_AttributeTableOfReal::GetRow(int theRow)
 {
   std::vector<double> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
     Handle(TColStd_HSequenceOfReal) aRow; 
     aRow = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetRowData(theRow);
     aLength = aRow->Length();
-    for(i = 1; i<= aLength; i++) aVector.push_back(aRow->Value(i));
+    for (i = 1; i <= aLength; i++) aVector.push_back(aRow->Value(i));
   }
   else {
     SALOMEDS::DoubleSeq_var aRow = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRow(theRow);
-    for(i = 0; i < aLength; i++) aVector.push_back(aRow[i]);
+    for (i = 0; i < aLength; i++) aVector.push_back(aRow[i]);
   }
 
   return aVector;
@@ -274,9 +304,10 @@ std::vector<double> SALOMEDS_AttributeTableOfReal::GetRow(int theRow)
 
 void SALOMEDS_AttributeTableOfReal::AddColumn(const std::vector<double>& theData)
 {
-  CheckLocked();
   int aLength = theData.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock; 
     Handle(SALOMEDSImpl_AttributeTableOfReal) aTable;
     aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl);
     Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal;
@@ -291,16 +322,17 @@ void SALOMEDS_AttributeTableOfReal::AddColumn(const std::vector<double>& theData
   else {
     SALOMEDS::DoubleSeq_var aColumn = new SALOMEDS::DoubleSeq();
     aColumn->length(aLength);
-    for(i = 0; i < aLength; i++) aColumn[i] = theData[i];
+    for (i = 0; i < aLength; i++) aColumn[i] = theData[i];
     SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->AddColumn(aColumn);
   }
 }
 
 void SALOMEDS_AttributeTableOfReal::SetColumn(int theColumn, const std::vector<double>& theData)
 {
-  CheckLocked();
   int aLength = theData.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock; 
     Handle(SALOMEDSImpl_AttributeTableOfReal) aTable;
     aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl);
     Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal;
@@ -315,7 +347,7 @@ void SALOMEDS_AttributeTableOfReal::SetColumn(int theColumn, const std::vector<d
   else {
     SALOMEDS::DoubleSeq_var aColumn = new SALOMEDS::DoubleSeq();
     aColumn->length(aLength);
-    for(i = 0; i < aLength; i++) aColumn[i] = theData[i];
+    for (i = 0; i < aLength; i++) aColumn[i] = theData[i];
     SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRow(theColumn, aColumn);
   }
 }
@@ -324,25 +356,28 @@ std::vector<double> SALOMEDS_AttributeTableOfReal::GetColumn(int theColumn)
 {
   std::vector<double> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
     Handle(TColStd_HSequenceOfReal) aColumn; 
     aColumn = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetColumnData(theColumn);
     aLength = aColumn->Length();
-    for(i = 1; i<= aLength; i++) aVector.push_back(aColumn->Value(i));
+    for (i = 1; i <= aLength; i++) aVector.push_back(aColumn->Value(i));
   }
   else {
     SALOMEDS::DoubleSeq_var aColumn = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetColumn(theColumn);
-    for(i = 0; i < aLength; i++) aVector.push_back(aColumn[i]);
+    for (i = 0; i < aLength; i++) aVector.push_back(aColumn[i]);
   }
   return aVector;
 }
 
 void SALOMEDS_AttributeTableOfReal::PutValue(double theValue, int theRow, int theColumn)
 {
-  CheckLocked();
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock; 
     try {
-      Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->PutValue(theValue, theRow, theColumn);
+      Handle(SALOMEDSImpl_AttributeTableOfReal)::
+        DownCast(_local_impl)->PutValue(theValue, theRow, theColumn);
     }   
     catch(...) {
       throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
@@ -356,7 +391,10 @@ void SALOMEDS_AttributeTableOfReal::PutValue(double theValue, int theRow, int th
 bool SALOMEDS_AttributeTableOfReal::HasValue(int theRow, int theColumn)
 {
   bool ret;
-  if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->HasValue(theRow, theColumn);
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
+    ret = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->HasValue(theRow, theColumn);
+  }
   else ret = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->HasValue(theRow, theColumn);
   return ret;
 }
@@ -364,7 +402,8 @@ bool SALOMEDS_AttributeTableOfReal::HasValue(int theRow, int theColumn)
 double SALOMEDS_AttributeTableOfReal::GetValue(int theRow, int theColumn)
 {
   double aValue;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
     try {
       aValue = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetValue(theRow, theColumn);
     }   
@@ -382,21 +421,25 @@ std::vector<int> SALOMEDS_AttributeTableOfReal::GetRowSetIndices(int theRow)
 {
   std::vector<int> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
     Handle(TColStd_HSequenceOfInteger) aSet; 
     aSet = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetSetRowIndices(theRow);
     aLength = aSet->Length();
-    for(i = 1; i<= aLength; i++) aVector.push_back(aSet->Value(i));
+    for (i = 1; i <= aLength; i++) aVector.push_back(aSet->Value(i));
   }
   else {
     SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowSetIndices(theRow);
-    for(i = 0; i < aLength; i++) aVector.push_back(aSet[i]);
+    for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]);
   }
   return aVector;
 }
 
 void SALOMEDS_AttributeTableOfReal::SetNbColumns(int theNbColumns)
 {
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetNbColumns(theNbColumns);
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetNbColumns(theNbColumns);
+  }
   else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetNbColumns(theNbColumns);
 }
index 0978252c7c92a923cef0e7ce50da96e522b35941..a999892a4f9c530c3fa3ace5f64fbba3a8f4fd51 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeTableOfString.hxx"
+#include "SALOMEDS.hxx"
 
 #include <string>
 #include <TCollection_AsciiString.hxx> 
 #include <TColStd_HSequenceOfReal.hxx>
 #include <TColStd_HSequenceOfExtendedString.hxx>
  
-SALOMEDS_AttributeTableOfString
-::SALOMEDS_AttributeTableOfString(const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr)
+SALOMEDS_AttributeTableOfString::SALOMEDS_AttributeTableOfString
+                  (const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr)
 :SALOMEDS_GenericAttribute(theAttr)
 {}
 
-SALOMEDS_AttributeTableOfString::SALOMEDS_AttributeTableOfString(SALOMEDS::AttributeTableOfString_ptr theAttr)
+SALOMEDS_AttributeTableOfString::SALOMEDS_AttributeTableOfString
+                  (SALOMEDS::AttributeTableOfString_ptr theAttr)
 :SALOMEDS_GenericAttribute(theAttr)
 {}
 
@@ -45,85 +47,99 @@ SALOMEDS_AttributeTableOfString::~SALOMEDS_AttributeTableOfString()
 
 void SALOMEDS_AttributeTableOfString::SetTitle(const std::string& theTitle)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str());
+  }
   else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetTitle(theTitle.c_str());
 }
 
 std::string SALOMEDS_AttributeTableOfString::GetTitle()
 {
   std::string aStr;
-  if(_isLocal) 
-    aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetTitle()).ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfString)::
+                                   DownCast(_local_impl)->GetTitle()).ToCString();
+  }
   else aStr = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetTitle();
   return aStr;
 }
 
 void SALOMEDS_AttributeTableOfString::SetRowTitle(int theIndex, const std::string& theTitle)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowTitle(theIndex, 
-                                                                                              (char*)theTitle.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTableOfString)::
+      DownCast(_local_impl)->SetRowTitle(theIndex, (char*)theTitle.c_str());
+  }
   else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowTitle(theIndex, theTitle.c_str());
 }
 
 void SALOMEDS_AttributeTableOfString::SetRowTitles(const std::vector<std::string>& theTitles)
 {
-  CheckLocked();
   int aLength = theTitles.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
-    for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
+    for (i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
     Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowTitles(aSeq);
   }
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for(i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str();
     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowTitles(aSeq);
   }
-  
 }
 
 std::vector<std::string> SALOMEDS_AttributeTableOfString::GetRowTitles()
 {
   std::vector<std::string> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfExtendedString) aSeq;
     aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowTitles();
     aLength = aSeq->Length();
-    for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+    for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
   }
   else {
     SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowTitles();
     aLength = aSeq->length();
-    for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+    for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in());
   }
   return aVector;
 }
 
 void SALOMEDS_AttributeTableOfString::SetColumnTitle(int theIndex, const std::string& theTitle)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetColumnTitle(theIndex, 
-                                                                                                 (char*)theTitle.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTableOfString)::
+      DownCast(_local_impl)->SetColumnTitle(theIndex, (char*)theTitle.c_str());
+  }
   else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumnTitle(theIndex, theTitle.c_str());
 }
 
 void SALOMEDS_AttributeTableOfString::SetColumnTitles(const std::vector<std::string>& theTitles)
 {
-  CheckLocked();
   int aLength = theTitles.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
-    for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
+    for (i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
     Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetColumnTitles(aSeq);
   }
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for(i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str();
     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumnTitles(aSeq);
   }
 }
@@ -132,41 +148,46 @@ std::vector<std::string> SALOMEDS_AttributeTableOfString::GetColumnTitles()
 {
   std::vector<std::string> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfExtendedString) aSeq;
     aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetColumnTitles();
     aLength = aSeq->Length();
-    for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+    for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
   }
   else {
     SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumnTitles();
     aLength = aSeq->length();
-    for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+    for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in());
   }
   return aVector;
 }
 
 void SALOMEDS_AttributeTableOfString::SetRowUnit(int theIndex, const std::string& theUnit)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowUnit(theIndex, 
-                                                                                             (char*)theUnit.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTableOfString)::
+      DownCast(_local_impl)->SetRowUnit(theIndex, (char*)theUnit.c_str());
+  }
   else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowUnit(theIndex, theUnit.c_str());
 }
 
 void SALOMEDS_AttributeTableOfString::SetRowUnits(const std::vector<std::string>& theUnits)
 {
-  CheckLocked();
   int aLength = theUnits.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
-    for(i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str());
+    for (i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str());
     Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowUnits(aSeq);
   }
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for(i = 0; i < aLength; i++) aSeq[i] = (char*)theUnits[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theUnits[i].c_str();
     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowUnits(aSeq);
   }
 }
@@ -175,16 +196,17 @@ std::vector<std::string> SALOMEDS_AttributeTableOfString::GetRowUnits()
 {
   std::vector<std::string> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfExtendedString) aSeq;
     aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowUnits();
     aLength = aSeq->Length();
-    for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+    for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
   }
   else {
     SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowUnits();
     aLength = aSeq->length();
-    for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+    for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in());
   }
   return aVector;
 }
@@ -192,7 +214,10 @@ std::vector<std::string> SALOMEDS_AttributeTableOfString::GetRowUnits()
 int SALOMEDS_AttributeTableOfString::GetNbRows()
 {
   int aNb;
-  if(_isLocal) aNb = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetNbRows();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aNb = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetNbRows();
+  }
   else aNb = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetNbRows();
   return aNb;
 }
@@ -200,17 +225,20 @@ int SALOMEDS_AttributeTableOfString::GetNbRows()
 int SALOMEDS_AttributeTableOfString::GetNbColumns()
 {  
   int aNb;
-  if(_isLocal) aNb = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetNbColumns();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aNb = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetNbColumns();
+  }
   else aNb = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetNbColumns();
   return aNb;
-  
 }
 
 void SALOMEDS_AttributeTableOfString::AddRow(const std::vector<std::string>& theData)
 {
-  CheckLocked();
   int aLength = theData.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTableOfString) aTable;
     aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl);
     Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString;
@@ -225,16 +253,17 @@ void SALOMEDS_AttributeTableOfString::AddRow(const std::vector<std::string>& the
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for(i = 0; i < aLength; i++) aSeq[i] = (char*)theData[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theData[i].c_str();
     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->AddRow(aSeq);
   }
 }
 
 void SALOMEDS_AttributeTableOfString::SetRow(int theRow, const std::vector<std::string>& theData)
 {
-  CheckLocked();
   int aLength = theData.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTableOfString) aTable;
     aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl);
     Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString;
@@ -249,7 +278,7 @@ void SALOMEDS_AttributeTableOfString::SetRow(int theRow, const std::vector<std::
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for(i = 0; i < aLength; i++) aSeq[i] = (char*)theData[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theData[i].c_str();
     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRow(theRow, aSeq);
   }
 }
@@ -258,15 +287,16 @@ std::vector<std::string> SALOMEDS_AttributeTableOfString::GetRow(int theRow)
 {
   std::vector<std::string> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfExtendedString) aRow; 
     aRow = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowData(theRow);
     aLength = aRow->Length();
-    for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aRow->Value(i)).ToCString());
+    for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aRow->Value(i)).ToCString());
   }
   else {
     SALOMEDS::StringSeq_var aRow = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRow(theRow);
-    for(i = 0; i < aLength; i++) aVector.push_back((char*)aRow[i].in());
+    for (i = 0; i < aLength; i++) aVector.push_back((char*)aRow[i].in());
   }
 
   return aVector;
@@ -274,9 +304,10 @@ std::vector<std::string> SALOMEDS_AttributeTableOfString::GetRow(int theRow)
 
 void SALOMEDS_AttributeTableOfString::AddColumn(const std::vector<std::string>& theData)
 {
-  CheckLocked();
   int aLength = theData.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTableOfString) aTable;
     aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl);
     Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString;
@@ -291,16 +322,17 @@ void SALOMEDS_AttributeTableOfString::AddColumn(const std::vector<std::string>&
   else {
     SALOMEDS::StringSeq_var aColumn = new SALOMEDS::StringSeq();
     aColumn->length(aLength);
-    for(i = 0; i < aLength; i++) aColumn[i] = (char*)theData[i].c_str();
+    for (i = 0; i < aLength; i++) aColumn[i] = (char*)theData[i].c_str();
     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->AddColumn(aColumn);
   }
 }
 
 void SALOMEDS_AttributeTableOfString::SetColumn(int theColumn, const std::vector<std::string>& theData)
 {
-  CheckLocked();
   int aLength = theData.size(), i;
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTableOfString) aTable;
     aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl);
     Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString;
@@ -315,7 +347,7 @@ void SALOMEDS_AttributeTableOfString::SetColumn(int theColumn, const std::vector
   else {
     SALOMEDS::StringSeq_var aColumn = new SALOMEDS::StringSeq();
     aColumn->length(aLength);
-    for(i = 0; i < aLength; i++) aColumn[i] = (char*)theData[i].c_str();
+    for (i = 0; i < aLength; i++) aColumn[i] = (char*)theData[i].c_str();
     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRow(theColumn, aColumn);
   }
 }
@@ -324,27 +356,31 @@ std::vector<std::string> SALOMEDS_AttributeTableOfString::GetColumn(int theColum
 {
   std::vector<std::string> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfExtendedString) aColumn; 
-    aColumn = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetColumnData(theColumn);
+    aColumn = Handle(SALOMEDSImpl_AttributeTableOfString)::
+      DownCast(_local_impl)->GetColumnData(theColumn);
     aLength = aColumn->Length();
-    for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aColumn->Value(i)).ToCString());
+    for (i = 1; i <= aLength; i++)
+      aVector.push_back(TCollection_AsciiString(aColumn->Value(i)).ToCString());
   }
   else {
-    SALOMEDS::StringSeq_var aColumn = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumn(theColumn);
-    for(i = 0; i < aLength; i++) aVector.push_back(aColumn[i].in());
+    SALOMEDS::StringSeq_var aColumn =
+      SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumn(theColumn);
+    for (i = 0; i < aLength; i++) aVector.push_back(aColumn[i].in());
   }
   return aVector;
 }
 
 void SALOMEDS_AttributeTableOfString::PutValue(const std::string& theValue, int theRow, int theColumn)
 {
-  CheckLocked();
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     try {
-      Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->PutValue((char*)theValue.c_str(), 
-                                                                                  theRow, 
-                                                                                  theColumn);
+      Handle(SALOMEDSImpl_AttributeTableOfString)::
+        DownCast(_local_impl)->PutValue((char*)theValue.c_str(), theRow, theColumn);
     }   
     catch(...) {
       throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
@@ -358,7 +394,10 @@ void SALOMEDS_AttributeTableOfString::PutValue(const std::string& theValue, int
 bool SALOMEDS_AttributeTableOfString::HasValue(int theRow, int theColumn)
 {
   bool ret;
-  if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->HasValue(theRow, theColumn);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->HasValue(theRow, theColumn);
+  }
   else ret = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->HasValue(theRow, theColumn);
   return ret;
 }
@@ -366,11 +405,11 @@ bool SALOMEDS_AttributeTableOfString::HasValue(int theRow, int theColumn)
 std::string SALOMEDS_AttributeTableOfString::GetValue(int theRow, int theColumn)
 {
   std::string aValue;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     try {
-      aValue = 
-          TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetValue(theRow,
-                                                                                                              theColumn)).ToCString();
+      aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfString)::
+                                       DownCast(_local_impl)->GetValue(theRow, theColumn)).ToCString();
     }   
     catch(...) {
       throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
@@ -386,21 +425,26 @@ std::vector<int> SALOMEDS_AttributeTableOfString::GetRowSetIndices(int theRow)
 {
   std::vector<int> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfInteger) aSet; 
     aSet = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetSetRowIndices(theRow);
     aLength = aSet->Length();
-    for(i = 1; i<= aLength; i++) aVector.push_back(aSet->Value(i));
+    for (i = 1; i <= aLength; i++) aVector.push_back(aSet->Value(i));
   }
   else {
-    SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowSetIndices(theRow);
-    for(i = 0; i < aLength; i++) aVector.push_back(aSet[i]);
+    SALOMEDS::LongSeq_var aSet =
+      SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowSetIndices(theRow);
+    for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]);
   }
   return aVector;
 }
 
 void SALOMEDS_AttributeTableOfString::SetNbColumns(int theNbColumns)
 {
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetNbColumns(theNbColumns);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetNbColumns(theNbColumns);
+  }
   else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetNbColumns(theNbColumns);
 }
index 62c6ce0218b7947778e6f2eacd73964eac1b3b8c..8511dac238ce4415efa33435b3348d1f8d8b00fd 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeTarget.hxx"
+#include "SALOMEDS.hxx"
 
 #include <TColStd_HSequenceOfTransient.hxx>
 
@@ -44,7 +45,10 @@ void SALOMEDS_AttributeTarget::Add(const _PTR(SObject)& theObject)
 {
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
 
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Add(aSO->GetLocalImpl());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Add(aSO->GetLocalImpl());
+  }
   else SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Add(aSO->GetCORBAImpl());
 }
 
@@ -54,10 +58,12 @@ std::vector<_PTR(SObject)> SALOMEDS_AttributeTarget::Get()
   int aLength, i;
   SALOMEDSClient_SObject* aSO = NULL;
   
-  if(_isLocal) {
-    Handle(TColStd_HSequenceOfTransient) aSeq = Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Get();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(TColStd_HSequenceOfTransient) aSeq =
+      Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Get();
     aLength = aSeq->Length();
-    for(i=1; i<=aLength; i++) {
+    for (i = 1; i <= aLength; i++) {
       aSO = new SALOMEDS_SObject(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)));
       aVector.push_back(_PTR(SObject)(aSO));
     }
@@ -66,7 +72,7 @@ std::vector<_PTR(SObject)> SALOMEDS_AttributeTarget::Get()
     SALOMEDS::Study::ListOfSObject_var aSeq = SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Get();
     aLength = aSeq->length();
     aSO = new SALOMEDS_SObject(aSeq[i].in());
-    for(i = 0; i<aLength; i++) aVector.push_back(_PTR(SObject)(aSO));
+    for (i = 0; i < aLength; i++) aVector.push_back(_PTR(SObject)(aSO));
   }
 
   return aVector;
@@ -76,7 +82,9 @@ void SALOMEDS_AttributeTarget::Remove(const _PTR(SObject)& theObject)
 {
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
 
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Remove(aSO->GetLocalImpl());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Remove(aSO->GetLocalImpl());
+  }
   else SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Remove(aSO->GetCORBAImpl());
 }
-
index c2da3fd0e09a3518415dcf6be47105f12cdbdaeb..6c23440b769f4ffc86bf3701ea10e09002e5a0ca 100644 (file)
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeTextColor.hxx"
+#include "SALOMEDS.hxx"
 
 #include <TColStd_HArray1OfReal.hxx>
 
-SALOMEDS_AttributeTextColor::SALOMEDS_AttributeTextColor(const Handle(SALOMEDSImpl_AttributeTextColor)& theAttr)
+SALOMEDS_AttributeTextColor::SALOMEDS_AttributeTextColor
+                  (const Handle(SALOMEDSImpl_AttributeTextColor)& theAttr)
 :SALOMEDS_GenericAttribute(theAttr)
 {}
 
@@ -40,8 +42,10 @@ SALOMEDS_AttributeTextColor::~SALOMEDS_AttributeTextColor()
 STextColor SALOMEDS_AttributeTextColor::TextColor()
 {
   STextColor aColor;
-  if(_isLocal) {
-    Handle(TColStd_HArray1OfReal) aSeq = Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_local_impl)->TextColor();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(TColStd_HArray1OfReal) aSeq =
+      Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_local_impl)->TextColor();
     aColor.R = aSeq->Value(1);
     aColor.G = aSeq->Value(2);
     aColor.B = aSeq->Value(3); 
@@ -54,11 +58,12 @@ STextColor SALOMEDS_AttributeTextColor::TextColor()
   }
   return aColor;
 }
+
 void SALOMEDS_AttributeTextColor::SetTextColor(STextColor value)
 {
-  CheckLocked();
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(TColStd_HArray1OfReal) aSeq = new TColStd_HArray1OfReal(1, 3);
     aSeq->SetValue(1, value.R);
     aSeq->SetValue(2, value.G);
index 7d2ea235232f92f21d64ead474fd4a04541ac3b4..d6d1a42869e3677117c933abc2202855aab27f62 100644 (file)
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeTextHighlightColor.hxx"
+#include "SALOMEDS.hxx"
 
 #include <TColStd_HArray1OfReal.hxx>
 
-SALOMEDS_AttributeTextHighlightColor::SALOMEDS_AttributeTextHighlightColor(const Handle(SALOMEDSImpl_AttributeTextHighlightColor)& theAttr)
+SALOMEDS_AttributeTextHighlightColor::SALOMEDS_AttributeTextHighlightColor
+                  (const Handle(SALOMEDSImpl_AttributeTextHighlightColor)& theAttr)
 :SALOMEDS_GenericAttribute(theAttr)
 {}
 
-SALOMEDS_AttributeTextHighlightColor::SALOMEDS_AttributeTextHighlightColor(SALOMEDS::AttributeTextHighlightColor_ptr theAttr)
+SALOMEDS_AttributeTextHighlightColor::SALOMEDS_AttributeTextHighlightColor
+                  (SALOMEDS::AttributeTextHighlightColor_ptr theAttr)
 :SALOMEDS_GenericAttribute(theAttr)
 {}
 
@@ -40,7 +43,8 @@ SALOMEDS_AttributeTextHighlightColor::~SALOMEDS_AttributeTextHighlightColor()
 STextColor SALOMEDS_AttributeTextHighlightColor::TextHighlightColor()
 {
   STextColor aColor;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(TColStd_HArray1OfReal) aSeq;
     aSeq = Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_local_impl)->TextHighlightColor();
     aColor.R = aSeq->Value(1);
@@ -48,17 +52,20 @@ STextColor SALOMEDS_AttributeTextHighlightColor::TextHighlightColor()
     aColor.B = aSeq->Value(3); 
   }
   else {
-    SALOMEDS::Color anImplColor = SALOMEDS::AttributeTextHighlightColor::_narrow(_corba_impl)->TextHighlightColor();
+    SALOMEDS::Color anImplColor =
+      SALOMEDS::AttributeTextHighlightColor::_narrow(_corba_impl)->TextHighlightColor();
     aColor.R = anImplColor.R;
     aColor.G = anImplColor.G;
     aColor.B = anImplColor.B;
   }
   return aColor;
 }
+
 void SALOMEDS_AttributeTextHighlightColor::SetTextHighlightColor(STextColor value)
 {
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(TColStd_HArray1OfReal) aSeq = new TColStd_HArray1OfReal(1, 3);
     aSeq->SetValue(1, value.R);
     aSeq->SetValue(2, value.G);
index e23f62e09639d38cb64a90df145968618eeb2a5a..2d2df71641a4dbe4b607cabd656bb729f69391c7 100644 (file)
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeTreeNode.hxx"
+#include "SALOMEDS.hxx"
 
 #include <string>
+
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
 #include <Standard_GUID.hxx>
@@ -47,7 +49,9 @@ SALOMEDS_AttributeTreeNode::~SALOMEDS_AttributeTreeNode()
 void SALOMEDS_AttributeTreeNode::SetFather(const _PTR(AttributeTreeNode)& value)
 {
   SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aFather;
     aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     aFather = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
@@ -63,8 +67,10 @@ void SALOMEDS_AttributeTreeNode::SetFather(const _PTR(AttributeTreeNode)& value)
 bool SALOMEDS_AttributeTreeNode::HasFather()
 {
   bool ret;
-  if(_isLocal) {
-    Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
+      Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     ret = aNode->HasFather();
   }
   else {
@@ -77,8 +83,10 @@ bool SALOMEDS_AttributeTreeNode::HasFather()
 _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetFather()
 {
   SALOMEDSClient_AttributeTreeNode* aTN  = NULL;
-  if(_isLocal) {
-    Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
+      Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     aTN = new SALOMEDS_AttributeTreeNode(aNode->GetFather());
   }
   else {
@@ -91,7 +99,9 @@ _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetFather()
 void SALOMEDS_AttributeTreeNode::SetPrevious(const _PTR(AttributeTreeNode)& value)
 {
   SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aPrev;
     aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     aPrev = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
@@ -107,8 +117,10 @@ void SALOMEDS_AttributeTreeNode::SetPrevious(const _PTR(AttributeTreeNode)& valu
 bool SALOMEDS_AttributeTreeNode::HasPrevious()
 {
   bool ret;
-  if(_isLocal) {
-    Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
+      Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     ret = aNode->HasPrevious();
   }
   else {
@@ -121,8 +133,10 @@ bool SALOMEDS_AttributeTreeNode::HasPrevious()
 _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetPrevious()
 {
   SALOMEDSClient_AttributeTreeNode* aTN = NULL;
-  if(_isLocal) {
-    Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
+      Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     aTN = new SALOMEDS_AttributeTreeNode(aNode->GetPrevious());
   }
   else {
@@ -135,7 +149,9 @@ _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetPrevious()
 void SALOMEDS_AttributeTreeNode::SetNext(const _PTR(AttributeTreeNode)& value)
 {
   SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aNext;
     aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     aNext = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
@@ -151,8 +167,10 @@ void SALOMEDS_AttributeTreeNode::SetNext(const _PTR(AttributeTreeNode)& value)
 bool SALOMEDS_AttributeTreeNode::HasNext()
 {
   bool ret;
-  if(_isLocal) {
-    Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
+      Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     ret = aNode->HasNext();
   }
   else {
@@ -165,8 +183,10 @@ bool SALOMEDS_AttributeTreeNode::HasNext()
 _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetNext()
 {
   SALOMEDSClient_AttributeTreeNode* aTN = NULL;
-  if(_isLocal) {
-    Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
+      Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     aTN = new SALOMEDS_AttributeTreeNode(aNode->GetNext());
   }
   else {
@@ -179,7 +199,9 @@ _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetNext()
 void SALOMEDS_AttributeTreeNode::SetFirst(const _PTR(AttributeTreeNode)& value)
 {
   SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aFirst;
     aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     aFirst = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
@@ -195,8 +217,10 @@ void SALOMEDS_AttributeTreeNode::SetFirst(const _PTR(AttributeTreeNode)& value)
 bool SALOMEDS_AttributeTreeNode::HasFirst()
 {
   bool ret;
-  if(_isLocal) {
-    Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
+      Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     ret = aNode->HasFirst();
   }
   else {
@@ -209,8 +233,10 @@ bool SALOMEDS_AttributeTreeNode::HasFirst()
 _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetFirst()
 {
   SALOMEDSClient_AttributeTreeNode* aTN = NULL;
-  if(_isLocal) {
-    Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
+      Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     aTN = new SALOMEDS_AttributeTreeNode(aNode->GetFirst());
   }
   else {
@@ -222,8 +248,11 @@ _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetFirst()
 
 void SALOMEDS_AttributeTreeNode::SetTreeID(const std::string& value)
 {
-  if(_isLocal) {
-    Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
+      Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     aNode->SetTreeID(Standard_GUID((char*)value.c_str()));
   }
   else {
@@ -235,8 +264,10 @@ void SALOMEDS_AttributeTreeNode::SetTreeID(const std::string& value)
 std::string SALOMEDS_AttributeTreeNode::GetTreeID()
 {
   TCollection_AsciiString aGUID;
-  if(_isLocal) {
-    Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
+      Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     char guid[40];
     aNode->GetTreeID().ToCString(guid);
     aGUID = TCollection_AsciiString(guid);
@@ -252,7 +283,9 @@ std::string SALOMEDS_AttributeTreeNode::GetTreeID()
 void SALOMEDS_AttributeTreeNode::Append(const _PTR(AttributeTreeNode)& value)
 {
   SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
     aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
@@ -268,7 +301,9 @@ void SALOMEDS_AttributeTreeNode::Append(const _PTR(AttributeTreeNode)& value)
 void SALOMEDS_AttributeTreeNode::Prepend(const _PTR(AttributeTreeNode)& value)
 {
   SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
     aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
@@ -284,7 +319,9 @@ void SALOMEDS_AttributeTreeNode::Prepend(const _PTR(AttributeTreeNode)& value)
 void SALOMEDS_AttributeTreeNode::InsertBefore(const _PTR(AttributeTreeNode)& value)
 {
   SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
     aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
@@ -300,7 +337,9 @@ void SALOMEDS_AttributeTreeNode::InsertBefore(const _PTR(AttributeTreeNode)& val
 void SALOMEDS_AttributeTreeNode::InsertAfter(const _PTR(AttributeTreeNode)& value)
 {
   SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
-  if(_isLocal) {
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
     aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
@@ -315,14 +354,21 @@ void SALOMEDS_AttributeTreeNode::InsertAfter(const _PTR(AttributeTreeNode)& valu
 
 void SALOMEDS_AttributeTreeNode::Remove()
 {
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->Remove();
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->Remove();
+  }
   else SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Remove();
 }
 
 int SALOMEDS_AttributeTreeNode::Depth()
 {
   int aDepth;
-  if(_isLocal) aDepth = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->Depth();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aDepth = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->Depth();
+  }
   else aDepth =  SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Depth();
   return aDepth;
 }
@@ -330,7 +376,10 @@ int SALOMEDS_AttributeTreeNode::Depth()
 bool SALOMEDS_AttributeTreeNode::IsRoot()
 {
   bool ret;
-  if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->IsRoot();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->IsRoot();
+  }
   else ret =  SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->IsRoot();
   return ret;
 }
@@ -339,7 +388,8 @@ bool SALOMEDS_AttributeTreeNode::IsDescendant(const _PTR(AttributeTreeNode)& val
 {
   bool ret;
   SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
     aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
@@ -357,7 +407,8 @@ bool SALOMEDS_AttributeTreeNode::IsFather(const _PTR(AttributeTreeNode)& value)
 {
   bool ret;
   SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
     aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
@@ -375,7 +426,8 @@ bool SALOMEDS_AttributeTreeNode::IsChild(const _PTR(AttributeTreeNode)& value)
 {
   bool ret;
   SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
     aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
     anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
@@ -391,10 +443,13 @@ bool SALOMEDS_AttributeTreeNode::IsChild(const _PTR(AttributeTreeNode)& value)
 
 std::string SALOMEDS_AttributeTreeNode::Label()
 {
-  TCollection_AsciiString aLabel;
-  if(_isLocal) TDF_Tool::Entry(_local_impl->Label(), aLabel);
+  string aLabel;
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    TCollection_AsciiString anAsciiLabel;
+    TDF_Tool::Entry(_local_impl->Label(), anAsciiLabel);
+    aLabel = std::string(anAsciiLabel.ToCString());
+  }
   else aLabel = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Label();
-  return std::string(aLabel.ToCString());
+  return aLabel;
 }
-
-
index fe277cc194cd80f16d3f960c17cdceb002c4902e..4d04a19bca8631e2c115619c834a479f027bfe3b 100644 (file)
@@ -22,6 +22,7 @@
 //  Module : SALOME
 
 #include "SALOMEDS_AttributeUserID.hxx"
+#include "SALOMEDS.hxx"
 
 #include <string>
 #include <TCollection_AsciiString.hxx> 
@@ -42,7 +43,8 @@ SALOMEDS_AttributeUserID::~SALOMEDS_AttributeUserID()
 std::string SALOMEDS_AttributeUserID::Value()
 {
   std::string aValue;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     char guid[40];
     Handle(SALOMEDSImpl_AttributeUserID)::DownCast(_local_impl)->Value().ToCString(guid);
     aValue = std::string(guid);
@@ -50,10 +52,14 @@ std::string SALOMEDS_AttributeUserID::Value()
   else aValue = SALOMEDS::AttributeUserID::_narrow(_corba_impl)->Value();
   return aValue;
 }
+
 void SALOMEDS_AttributeUserID::SetValue(const std::string& value)
 {
-  CheckLocked();
-  if(_isLocal) Handle(SALOMEDSImpl_AttributeUserID)::DownCast(_local_impl)->SetValue(Standard_GUID((char*)value.c_str()));
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_AttributeUserID)::
+      DownCast(_local_impl)->SetValue(Standard_GUID((char*)value.c_str()));
+  }
   else SALOMEDS::AttributeUserID::_narrow(_corba_impl)->SetValue(value.c_str());
 }
index 1814b6526f49939ed79b6de5aae214ad1062a5ad..a31bbbf188cff3d6c47ff8e3d096e1e8396d4c64 100644 (file)
 
 #include "SALOMEDS_ChildIterator.hxx"
 #include "SALOMEDS_SObject.hxx"
+#include "SALOMEDS.hxx"
 
 using namespace std; 
 
 SALOMEDS_ChildIterator::SALOMEDS_ChildIterator(const Handle(SALOMEDSImpl_ChildIterator)& theIterator)
 {
+  SALOMEDS::Locker lock;
+
   _isLocal = true;
   _local_impl = theIterator;
   _corba_impl = SALOMEDS::ChildIterator::_nil();
@@ -49,34 +52,49 @@ SALOMEDS_ChildIterator::~SALOMEDS_ChildIterator()
 
 void SALOMEDS_ChildIterator::Init()
 {
-  if(_isLocal) _local_impl->Init();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    _local_impl->Init();
+  }
   else _corba_impl->Init();
 }
 
 void SALOMEDS_ChildIterator::InitEx(bool theAllLevels)
 {
-  if(_isLocal) _local_impl->InitEx(theAllLevels);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    _local_impl->InitEx(theAllLevels);
+  }
   else _corba_impl->InitEx(theAllLevels);
 }
 
 bool SALOMEDS_ChildIterator::More()
 {
   bool ret;
-  if(_isLocal) ret = _local_impl->More();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = _local_impl->More();
+  }
   else ret = _corba_impl->More();
   return ret;
 }
 
 void SALOMEDS_ChildIterator::Next() 
 {
-  if(_isLocal) _local_impl->Next();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    _local_impl->Next();
+  }
   else _corba_impl->Next();
 }
 
 _PTR(SObject) SALOMEDS_ChildIterator::Value()
 {
   SALOMEDSClient_SObject* aSO;
-  if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->Value());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aSO = new SALOMEDS_SObject(_local_impl->Value());
+  }
   else aSO = new SALOMEDS_SObject(_corba_impl->Value());
   return _PTR(SObject)(aSO);
 }
index 295781b884c5dbdabbfcb91fed66298884ed26fb..2f4f085cafd11e210ed674aaf88580ed690da481 100644 (file)
@@ -41,11 +41,12 @@ unsigned char* SALOMEDS_Driver_i::Save(const Handle(SALOMEDSImpl_SComponent)& th
   SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
   SALOMEDS::TMPFile_var aStream;
   CORBA::String_var url = CORBA::string_dup(theURL.ToCString());
-  SALOMEDS::unlock(); 
+  SALOMEDS::unlock();
   aStream = _driver->Save(sco.in(), url, isMultiFile);
+  SALOMEDS::lock();
   theStreamLength = aStream->length();
   unsigned char* aRetStream = NULL;
-  if(theStreamLength > 0) {
+  if (theStreamLength > 0) {
     aRetStream = new unsigned char[theStreamLength];
     memcpy(aRetStream, aStream->NP_data(), theStreamLength);
   }
@@ -60,11 +61,12 @@ unsigned char* SALOMEDS_Driver_i::SaveASCII(const Handle(SALOMEDSImpl_SComponent
   SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
   SALOMEDS::TMPFile_var aStream;
   CORBA::String_var url = CORBA::string_dup(theURL.ToCString());
-  SALOMEDS::unlock(); 
+  SALOMEDS::unlock();
   aStream = _driver->SaveASCII(sco.in(), url, isMultiFile);
+  SALOMEDS::lock();
   theStreamLength = aStream->length();
   unsigned char* aRetStream = NULL;
-  if(theStreamLength > 0) {
+  if (theStreamLength > 0) {
     aRetStream = new unsigned char[theStreamLength];
     memcpy(aRetStream, aStream->NP_data(), theStreamLength);
   }
@@ -79,16 +81,18 @@ bool SALOMEDS_Driver_i::Load(const Handle(SALOMEDSImpl_SComponent)& theComponent
 {
   SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
   CORBA::String_var url = CORBA::string_dup(theURL.ToCString());
-  CORBA::Octet* anOctetBuf =  (CORBA::Octet*)theStream;
+  CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream;
 
   SALOMEDS::TMPFile_var aStream;
-  if(theStreamLength > 0) 
+  if (theStreamLength > 0) 
     aStream = new SALOMEDS::TMPFile(theStreamLength, theStreamLength, anOctetBuf, 0);  
   else 
     aStream = new SALOMEDS::TMPFile(0);
 
-  SALOMEDS::unlock(); 
-  return _driver->Load(sco.in(), aStream.in(), url, isMultiFile);
+  SALOMEDS::unlock();
+  bool isOk = _driver->Load(sco.in(), aStream.in(), url, isMultiFile);
+  SALOMEDS::lock();
+  return isOk;
 }
 
 bool SALOMEDS_Driver_i::LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
@@ -99,7 +103,7 @@ bool SALOMEDS_Driver_i::LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComp
 {
   SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
   CORBA::String_var url = CORBA::string_dup(theURL.ToCString());
-  CORBA::Octet* anOctetBuf =  (CORBA::Octet*)theStream;
+  CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream;
 
   SALOMEDS::TMPFile_var aStream;
   if(theStreamLength > 0) 
@@ -107,17 +111,20 @@ bool SALOMEDS_Driver_i::LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComp
   else 
     aStream = new SALOMEDS::TMPFile(0);
 
-  SALOMEDS::unlock(); 
-  return _driver->LoadASCII(sco.in(), aStream.in(), url, isMultiFile);
+  SALOMEDS::unlock();
+  bool isOk = _driver->LoadASCII(sco.in(), aStream.in(), url, isMultiFile);
+  SALOMEDS::lock();
+  return isOk;
 }
 
 void SALOMEDS_Driver_i::Close(const Handle(SALOMEDSImpl_SComponent)& theComponent)
 {
   SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
-  SALOMEDS::unlock(); 
+  SALOMEDS::unlock();
   _driver->Close(sco.in());
+  SALOMEDS::lock();
 }
+
 
 
 TCollection_AsciiString SALOMEDS_Driver_i::IORToLocalPersistentID(const Handle(SALOMEDSImpl_SObject)& theSObject,
@@ -127,8 +134,9 @@ TCollection_AsciiString SALOMEDS_Driver_i::IORToLocalPersistentID(const Handle(S
 {
   SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theSObject, _orb);
   CORBA::String_var ior = CORBA::string_dup(IORString.ToCString());
-  SALOMEDS::unlock(); 
+  SALOMEDS::unlock();
   CORBA::String_var pers_string =_driver->IORToLocalPersistentID(so.in(), ior.in(), isMultiFile, isASCII);
+  SALOMEDS::lock();
   return TCollection_AsciiString(pers_string);
 }
 
@@ -140,8 +148,9 @@ TCollection_AsciiString SALOMEDS_Driver_i::LocalPersistentIDToIOR(const Handle(S
 {
   SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb);
   CORBA::String_var pers_string = CORBA::string_dup(aLocalPersistentID.ToCString());
-  SALOMEDS::unlock(); 
-  CORBA::String_var IOR =_driver->LocalPersistentIDToIOR(so.in(), pers_string.in(), isMultiFile, isASCII);
+  SALOMEDS::unlock();
+  CORBA::String_var IOR = _driver->LocalPersistentIDToIOR(so.in(), pers_string.in(), isMultiFile, isASCII);
+  SALOMEDS::lock();
   return TCollection_AsciiString(IOR);
 }
 
@@ -149,7 +158,9 @@ bool SALOMEDS_Driver_i::CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject)
 {
   SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb);
   SALOMEDS::unlock();
-  return _driver->CanCopy(so.in());
+  bool isOk = _driver->CanCopy(so.in());
+  SALOMEDS::lock();
+  return isOk;
 }
 
 
@@ -163,6 +174,7 @@ unsigned char* SALOMEDS_Driver_i::CopyFrom(const Handle(SALOMEDSImpl_SObject)& t
 
   SALOMEDS::unlock();
   aStream = _driver->CopyFrom(so.in(), anObjectID);
+  SALOMEDS::lock();
 
   theObjectID = anObjectID;
   theStreamLength = aStream->length();
@@ -179,7 +191,9 @@ unsigned char* SALOMEDS_Driver_i::CopyFrom(const Handle(SALOMEDSImpl_SObject)& t
 bool SALOMEDS_Driver_i::CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID)
 {
   SALOMEDS::unlock();
-  return _driver->CanPaste(theComponentName.ToCString(), theObjectID);
+  bool canPaste = _driver->CanPaste(theComponentName.ToCString(), theObjectID);
+  SALOMEDS::lock();
+  return canPaste;
 }
 
 TCollection_AsciiString SALOMEDS_Driver_i::PasteInto(const unsigned char* theStream,
@@ -198,6 +212,7 @@ TCollection_AsciiString SALOMEDS_Driver_i::PasteInto(const unsigned char* theStr
 
   SALOMEDS::unlock();
   SALOMEDS::SObject_var ret_so = _driver->PasteInto(aStream.in(), theObjectID, so.in());
+  SALOMEDS::lock();
 
   return TCollection_AsciiString((char*)ret_so->GetID());
 }
@@ -232,7 +247,8 @@ unsigned char* SALOMEDS_Driver_i::DumpPython(const Handle(SALOMEDSImpl_Study)& t
 //                                          SALOMEDS_DriverFactory
 //###############################################################################################################
 
-SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByType(const TCollection_AsciiString& theComponentType)
+SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByType
+                     (const TCollection_AsciiString& theComponentType)
 {
   CORBA::Object_var obj;
 
@@ -240,14 +256,16 @@ SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByType(const TCollection
   if (theComponentType == "SUPERV") aFactoryType = "SuperVisionContainer";
   else aFactoryType = "FactoryServer";
 
-  SALOMEDS::unlock();   
-  obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component(aFactoryType.ToCString(), 
-                                                                 theComponentType.ToCString());
-  
+  SALOMEDS::unlock();
+  obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component
+    (aFactoryType.ToCString(), theComponentType.ToCString());
+  SALOMEDS::lock();
+
   if (CORBA::is_nil(obj)) {
-    obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component("FactoryServerPy", theComponentType.ToCString());
+    obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component
+      ("FactoryServerPy", theComponentType.ToCString());
   }
-               
+
   if (!CORBA::is_nil(obj)) {
     SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj);
     return new SALOMEDS_Driver_i(aDriver, _orb);
index ca66fdac64693e9a16412fb4d0a5f70f29f32f29..0e338f3b192a59a4b9f81f21544e618733966a74 100644 (file)
@@ -30,6 +30,7 @@
 #include "SALOMEDSImpl_SObject.hxx"
 #include "SALOMEDS_SObject.hxx"
 #include "SALOMEDS_ClientAttributes.hxx"
+#include "SALOMEDS.hxx"
 
 #ifdef WIN32
 #include <process.h>
@@ -77,7 +78,8 @@ SALOMEDS_GenericAttribute::~SALOMEDS_GenericAttribute()
 
 void SALOMEDS_GenericAttribute::CheckLocked() 
 {
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     try {
       _local_impl->CheckLocked();
     }
@@ -93,7 +95,8 @@ void SALOMEDS_GenericAttribute::CheckLocked()
 std::string SALOMEDS_GenericAttribute::Type()
 {
   std::string aType;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     aType = _local_impl->Type().ToCString();
   }
   else {
@@ -105,7 +108,8 @@ std::string SALOMEDS_GenericAttribute::Type()
 std::string SALOMEDS_GenericAttribute::GetClassType()
 {
   std::string aType;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     aType = _local_impl->GetClassType().ToCString();
   }
   else {
@@ -117,7 +121,8 @@ std::string SALOMEDS_GenericAttribute::GetClassType()
 _PTR(SObject) SALOMEDS_GenericAttribute::GetSObject()
 {
   SALOMEDSClient_SObject* aSO = NULL;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     aSO = new SALOMEDS_SObject(_local_impl->GetSObject());
   }
   else {
@@ -128,12 +133,15 @@ _PTR(SObject) SALOMEDS_GenericAttribute::GetSObject()
 }
 
 
-SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA)
+SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute
+                           (const Handle(SALOMEDSImpl_GenericAttribute)& theGA)
 {
+  SALOMEDS::Locker lock;
+
   SALOMEDS_GenericAttribute* aGA = NULL;
   std::string aTypeOfAttribute = theGA->GetClassType().ToCString();
   __CreateGenericClientAttributeLocal
-  return aGA;  
+  return aGA;
 }
 
 SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(SALOMEDS::GenericAttribute_ptr theGA)
@@ -141,6 +149,5 @@ SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(SALOMEDS::
   SALOMEDS_GenericAttribute* aGA = NULL;
   std::string aTypeOfAttribute = theGA->GetClassType();
   __CreateGenericClientAttributeCORBA
-  return aGA;  
+  return aGA;
 }
-
index d4bd10e18f7f0c854b17456f711880f367c49be1..dcfc754948b8c23c9f4c4d8da241e7da7e719709 100644 (file)
@@ -92,17 +92,18 @@ char* SALOMEDS_GenericAttribute_i::GetClassType()
   if (!_impl.IsNull()) {
     return CORBA::string_dup(SALOMEDSImpl_GenericAttribute::Impl_GetClassType(_impl));
   }
-         
+
   return "";
-}  
+}
 
 
-SALOMEDS::GenericAttribute_ptr SALOMEDS_GenericAttribute_i::CreateAttribute(const Handle(TDF_Attribute)& theAttr,
-                                                                           CORBA::ORB_ptr theOrb) 
+SALOMEDS::GenericAttribute_ptr SALOMEDS_GenericAttribute_i::CreateAttribute
+                                        (const Handle(TDF_Attribute)& theAttr,
+                                         CORBA::ORB_ptr theOrb)
 {
-/*
   SALOMEDS::Locker lock;
-  
+
+/*
   static std::map<TDF_Attribute*, SALOMEDS_GenericAttribute_i*> _mapOfAttrib;
   SALOMEDS::GenericAttribute_var anAttribute;
   SALOMEDS_GenericAttribute_i* attr_servant = NULL;
@@ -118,13 +119,14 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_GenericAttribute_i::CreateAttribute(cons
   }
 */
   // mpv: now servants Destroyed by common algos of CORBA
-  char* aTypeOfAttribute = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr)->GetClassType().ToCString();
+  char* aTypeOfAttribute = Handle(SALOMEDSImpl_GenericAttribute)::
+    DownCast(theAttr)->GetClassType().ToCString();
   SALOMEDS::GenericAttribute_var anAttribute;
   SALOMEDS_GenericAttribute_i* attr_servant = NULL;
   __CreateGenericCORBAAttribute
 
   return anAttribute._retn(); 
-}                                                                                                                    
+}
 
 //===========================================================================
 //   PRIVATE FUNCTIONS
@@ -135,7 +137,7 @@ long SALOMEDS_GenericAttribute_i::GetLocalImpl(const char* theHostname, CORBA::L
   long pid = (long)_getpid();
 #else
   long pid = (long)getpid();
-#endif  
+#endif
   isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
   TDF_Attribute* local_impl = _impl.operator->();
   return ((long)local_impl);
index eaf98f1579d0228b38dbb1bf6be6e2e9681070b9..f061fcc5f9d08d7e26b9251a846541a8d15cac4a 100644 (file)
 
 
 #include "SALOMEDS_SComponent.hxx"
+
+#include "SALOMEDS.hxx"
 #include "SALOMEDS_SComponent_i.hxx"
+
 #include <string> 
 #include <TCollection_AsciiString.hxx> 
 
@@ -44,7 +47,8 @@ SALOMEDS_SComponent::~SALOMEDS_SComponent()
 std::string SALOMEDS_SComponent::ComponentDataType()
 {
   std::string aType;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     aType = (Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()))->ComponentDataType().ToCString();
   }
   else aType = (SALOMEDS::SComponent::_narrow(GetCORBAImpl()))->ComponentDataType();
@@ -55,7 +59,8 @@ std::string SALOMEDS_SComponent::ComponentDataType()
 bool SALOMEDS_SComponent::ComponentIOR(std::string& theID)
 {
   bool ret;
-  if(_isLocal) { 
+  if (_isLocal) { 
+    SALOMEDS::Locker lock;
     TCollection_AsciiString anIOR;
     ret = (Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()))->ComponentIOR(anIOR);
     theID = anIOR.ToCString();
@@ -71,10 +76,10 @@ bool SALOMEDS_SComponent::ComponentIOR(std::string& theID)
 
 SALOMEDS::SComponent_ptr SALOMEDS_SComponent::GetSComponent()
 {
-  if(_isLocal) {
-    if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SComponent::_narrow(GetCORBAImpl());
-    SALOMEDS::SComponent_var aSCO = SALOMEDS_SComponent_i::New(Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()),
-                                                              _orb);
+  if (_isLocal) {
+    if (!CORBA::is_nil(_corba_impl)) return SALOMEDS::SComponent::_narrow(GetCORBAImpl());
+    SALOMEDS::SComponent_var aSCO =
+      SALOMEDS_SComponent_i::New(Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()), _orb);
     return aSCO._retn();
   }
   else {
@@ -83,4 +88,3 @@ SALOMEDS::SComponent_ptr SALOMEDS_SComponent::GetSComponent()
 
   return SALOMEDS::SComponent::_nil();
 }
-
index 73ab05039fdf4bda89251876f76803c626856731..56d6c94272b357d3e5188096a5b8603606f486fb 100644 (file)
 //  Module : SALOME
 
 #include "SALOMEDS_SComponentIterator.hxx"
-#include "SALOMEDSImpl_SComponent.hxx"
+
+#include "SALOMEDS.hxx"
 #include "SALOMEDS_SComponent.hxx"
+#include "SALOMEDSImpl_SComponent.hxx"
 
 SALOMEDS_SComponentIterator::SALOMEDS_SComponentIterator(const SALOMEDSImpl_SComponentIterator& theIterator)
 :_local_impl(theIterator)
@@ -45,28 +47,40 @@ SALOMEDS_SComponentIterator::~SALOMEDS_SComponentIterator()
 
 void SALOMEDS_SComponentIterator::Init()
 {
-  if(_isLocal) _local_impl.Init();
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
+    _local_impl.Init();
+  }
   else _corba_impl->Init();
 }
 
 bool SALOMEDS_SComponentIterator::More()
 {
   bool ret;
-  if(_isLocal) ret = _local_impl.More();
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
+    ret = _local_impl.More();
+  }
   else ret = _corba_impl->More();
   return ret;
 }
+
 void SALOMEDS_SComponentIterator::Next()
 {
-  if(_isLocal) _local_impl.Next();
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
+    _local_impl.Next();
+  }
   else _corba_impl->Next();
 }
+
 _PTR(SComponent) SALOMEDS_SComponentIterator::Value()  
 {
   SALOMEDSClient_SComponent* aSCO = NULL;
-  if(_isLocal) aSCO = new SALOMEDS_SComponent(_local_impl.Value());
+  if (_isLocal) {
+    SALOMEDS::Locker lock; 
+    aSCO = new SALOMEDS_SComponent(_local_impl.Value());
+  }
   else aSCO = new SALOMEDS_SComponent(_corba_impl->Value());
   return _PTR(SComponent)(aSCO);
 }
index eaf664e03cbd987f459c06f659255a7838005b5f..233c5fca805dfd5d790d5418ff401ff459a4dec8 100644 (file)
 #include <TColStd_HSequenceOfTransient.hxx>
 
 #include "SALOMEDS_SObject.hxx"
+
+#include "SALOMEDS.hxx"
 #include "SALOMEDS_SComponent.hxx"
-#include "SALOMEDSImpl_SComponent.hxx"
 #include "SALOMEDS_GenericAttribute.hxx"
-#include "SALOMEDSImpl_GenericAttribute.hxx"
 #include "SALOMEDS_Study.hxx"
+
+#include "SALOMEDSImpl_SComponent.hxx"
+#include "SALOMEDSImpl_GenericAttribute.hxx"
 #include "SALOMEDSImpl_Study.hxx"
 
 #include "Utils_ORB_INIT.hxx" 
@@ -90,15 +93,20 @@ SALOMEDS_SObject::~SALOMEDS_SObject()
 std::string SALOMEDS_SObject::GetID()
 {
   std::string aValue;
-  if(_isLocal) aValue = _local_impl->GetID().ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aValue = _local_impl->GetID().ToCString();
+  }
   else aValue = _corba_impl->GetID();  
   return aValue;
 }
 
 _PTR(SComponent) SALOMEDS_SObject::GetFatherComponent()
 {
-  if(_isLocal) {
-    Handle(SALOMEDSImpl_SComponent) aSCO = Handle(SALOMEDSImpl_SComponent)::DownCast(_local_impl->GetFatherComponent());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    Handle(SALOMEDSImpl_SComponent) aSCO =
+      Handle(SALOMEDSImpl_SComponent)::DownCast(_local_impl->GetFatherComponent());
     return _PTR(SComponent)(new SALOMEDS_SComponent(aSCO));
   }
   return _PTR(SComponent)(new SALOMEDS_SComponent(_corba_impl->GetFatherComponent()));
@@ -106,14 +114,19 @@ _PTR(SComponent) SALOMEDS_SObject::GetFatherComponent()
 
 _PTR(SObject) SALOMEDS_SObject::GetFather()
 {
-  if(_isLocal) return _PTR(SObject)(new SALOMEDS_SObject(_local_impl->GetFather()));
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    return _PTR(SObject)(new SALOMEDS_SObject(_local_impl->GetFather()));
+  }
   return _PTR(SObject)(new SALOMEDS_SObject(_corba_impl->GetFather()));
 }
 
-bool SALOMEDS_SObject::FindAttribute(_PTR(GenericAttribute)& anAttribute, const std::string& aTypeOfAttribute)
+bool SALOMEDS_SObject::FindAttribute(_PTR(GenericAttribute)& anAttribute,
+                                     const std::string& aTypeOfAttribute)
 {
   bool ret = false;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_GenericAttribute) anAttr;
     ret = _local_impl->FindAttribute(anAttr, (char*)aTypeOfAttribute.c_str());
     if(ret) anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(anAttr));
@@ -130,7 +143,8 @@ bool SALOMEDS_SObject::FindAttribute(_PTR(GenericAttribute)& anAttribute, const
 bool SALOMEDS_SObject::ReferencedObject(_PTR(SObject)& theObject)
 {
   bool ret = false;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_SObject) aSO;
     ret = _local_impl->ReferencedObject(aSO);
     if(ret) theObject = _PTR(SObject)(new SALOMEDS_SObject(aSO));
@@ -148,7 +162,8 @@ bool SALOMEDS_SObject::ReferencedObject(_PTR(SObject)& theObject)
 bool SALOMEDS_SObject::FindSubObject(int theTag, _PTR(SObject)& theObject)
 {
   bool ret = false;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(SALOMEDSImpl_SObject) aSO;
     ret = _local_impl->FindSubObject(theTag, aSO);
     if(ret) theObject = _PTR(SObject)(new SALOMEDS_SObject(aSO));
@@ -164,14 +179,20 @@ bool SALOMEDS_SObject::FindSubObject(int theTag, _PTR(SObject)& theObject)
 
 _PTR(Study) SALOMEDS_SObject::GetStudy()
 {
-  if(_isLocal) return _PTR(Study)(new SALOMEDS_Study(_local_impl->GetStudy()));
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    return _PTR(Study)(new SALOMEDS_Study(_local_impl->GetStudy()));
+  }
   return _PTR(Study)(new SALOMEDS_Study(_corba_impl->GetStudy()));
 }
 
 std::string SALOMEDS_SObject::Name()
 {
   std::string aName;
-  if(_isLocal) aName = _local_impl->Name().ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aName = _local_impl->Name().ToCString();
+  }
   else aName = _corba_impl->Name();
 
   return aName;
@@ -179,7 +200,10 @@ std::string SALOMEDS_SObject::Name()
 
 void  SALOMEDS_SObject::Name(const std::string& theName)
 {
-  if(_isLocal) _local_impl->Name((char*)theName.c_str());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    _local_impl->Name((char*)theName.c_str());
+  }
   else _corba_impl->Name(theName.c_str());
 }
 
@@ -189,18 +213,20 @@ vector<_PTR(GenericAttribute)> SALOMEDS_SObject::GetAllAttributes()
   int aLength = 0;
   SALOMEDSClient_GenericAttribute* anAttr;
 
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->GetAllAttributes();
     aLength = aSeq->Length();
-    for(int i = 1; i <= aLength; i++) {
-      anAttr = SALOMEDS_GenericAttribute::CreateAttribute(Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aSeq->Value(i)));
+    for (int i = 1; i <= aLength; i++) {
+      anAttr = SALOMEDS_GenericAttribute::CreateAttribute
+        (Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aSeq->Value(i)));
       aVector.push_back(_PTR(GenericAttribute)(anAttr));
     }
   }
   else {
     SALOMEDS::ListOfAttributes_var aSeq = _corba_impl->GetAllAttributes();
     aLength = aSeq->length();
-    for(int i = 0; i < aLength; i++) {
+    for (int i = 0; i < aLength; i++) {
       anAttr = SALOMEDS_GenericAttribute::CreateAttribute(aSeq[i]);
       aVector.push_back(_PTR(GenericAttribute)(anAttr));
     }
@@ -212,7 +238,10 @@ vector<_PTR(GenericAttribute)> SALOMEDS_SObject::GetAllAttributes()
 std::string SALOMEDS_SObject::GetName()
 {
   std::string aName;
-  if(_isLocal) aName = _local_impl->GetName().ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aName = _local_impl->GetName().ToCString();
+  }
   else aName = _corba_impl->GetName();
 
   return aName;
@@ -221,7 +250,10 @@ std::string SALOMEDS_SObject::GetName()
 std::string SALOMEDS_SObject::GetComment()
 {
   std::string aComment;
-  if(_isLocal) aComment = _local_impl->GetComment().ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aComment = _local_impl->GetComment().ToCString();
+  }
   else aComment = _corba_impl->GetComment();
 
   return aComment;
@@ -230,7 +262,10 @@ std::string SALOMEDS_SObject::GetComment()
 std::string SALOMEDS_SObject::GetIOR()
 {
   std::string anIOR;
-  if(_isLocal) anIOR = _local_impl->GetIOR().ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    anIOR = _local_impl->GetIOR().ToCString();
+  }
   else anIOR = _corba_impl->GetIOR();
 
   return anIOR;
@@ -238,20 +273,27 @@ std::string SALOMEDS_SObject::GetIOR()
 
 int SALOMEDS_SObject::Tag()
 {
-  if(_isLocal) return _local_impl->Tag();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    return _local_impl->Tag();
+  }
   return _corba_impl->Tag(); 
 }
 
 int SALOMEDS_SObject::Depth()
 {
-  if(_isLocal) return _local_impl->Depth();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    return _local_impl->Depth();
+  }
   return _corba_impl->Depth();  
 }
 
 CORBA::Object_ptr SALOMEDS_SObject::GetObject()
 {
   CORBA::Object_var obj;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     std::string anIOR = GetIOR();
     if (!anIOR.empty())
       obj = _orb->string_to_object(anIOR.c_str());
index 1f6c1ee8719408dccad0baa76082c86b606cf111..17e3fcba0cdd81f819a9dd02112df47adf3fe8c0 100644 (file)
 #include "utilities.h" 
 
 #include "SALOMEDS_Study.hxx"
+
+#include "SALOMEDS.hxx"
 #include "SALOMEDS_SComponent.hxx"
-#include "SALOMEDSImpl_SComponent.hxx"
 #include "SALOMEDS_SObject.hxx"
-#include "SALOMEDSImpl_SObject.hxx"
 #include "SALOMEDS_StudyBuilder.hxx"
-#include "SALOMEDSImpl_StudyBuilder.hxx"
 #include "SALOMEDS_ChildIterator.hxx"
-#include "SALOMEDSImpl_ChildIterator.hxx"
 #include "SALOMEDS_SComponentIterator.hxx"
-#include "SALOMEDSImpl_SComponentIterator.hxx"
 #include "SALOMEDS_AttributeStudyProperties.hxx"
-#include "SALOMEDSImpl_AttributeStudyProperties.hxx"
 #include "SALOMEDS_UseCaseBuilder.hxx"
+
+#include "SALOMEDSImpl_SComponent.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_StudyBuilder.hxx"
+#include "SALOMEDSImpl_ChildIterator.hxx"
+#include "SALOMEDSImpl_SComponentIterator.hxx"
+#include "SALOMEDSImpl_AttributeStudyProperties.hxx"
 #include "SALOMEDSImpl_UseCaseBuilder.hxx"
 
 #include "SALOMEDS_Driver_i.hxx"
@@ -98,7 +101,10 @@ SALOMEDS_Study::~SALOMEDS_Study()
 std::string SALOMEDS_Study::GetPersistentReference()
 {
   std::string aRef;
-  if(_isLocal) aRef = _local_impl->GetPersistentReference().ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aRef = _local_impl->GetPersistentReference().ToCString();
+  }
   else aRef = _corba_impl->GetPersistentReference();
   return aRef;
 }
@@ -106,7 +112,10 @@ std::string SALOMEDS_Study::GetPersistentReference()
 std::string SALOMEDS_Study::GetTransientReference()
 {
   std::string aRef;
-  if(_isLocal) aRef = _local_impl->GetTransientReference().ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aRef = _local_impl->GetTransientReference().ToCString();
+  }
   else aRef = _corba_impl->GetTransientReference();
   return aRef;
 }
@@ -114,7 +123,10 @@ std::string SALOMEDS_Study::GetTransientReference()
 bool SALOMEDS_Study::IsEmpty()
 {
   bool ret;
-  if(_isLocal) ret = _local_impl->IsEmpty();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = _local_impl->IsEmpty();
+  }
   else ret = _corba_impl->IsEmpty();
   return ret;
 }
@@ -122,14 +134,17 @@ bool SALOMEDS_Study::IsEmpty()
 _PTR(SComponent) SALOMEDS_Study::FindComponent (const std::string& aComponentName)
 {
   SALOMEDSClient_SComponent* aSCO = NULL;
-  if(_isLocal) {
-    Handle(SALOMEDSImpl_SComponent) aSCO_impl =_local_impl->FindComponent((char*)aComponentName.c_str());
-    if(aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
+    Handle(SALOMEDSImpl_SComponent) aSCO_impl =
+      _local_impl->FindComponent((char*)aComponentName.c_str());
+    if (aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO);
     aSCO = new SALOMEDS_SComponent(aSCO_impl);
   }
   else {
     SALOMEDS::SComponent_var aSCO_impl = _corba_impl->FindComponent((char*)aComponentName.c_str());
-    if(CORBA::is_nil(aSCO_impl)) return _PTR(SComponent)(aSCO);
+    if (CORBA::is_nil(aSCO_impl)) return _PTR(SComponent)(aSCO);
     aSCO = new SALOMEDS_SComponent(aSCO_impl);
   }
   return _PTR(SComponent)(aSCO);
@@ -138,9 +153,12 @@ _PTR(SComponent) SALOMEDS_Study::FindComponent (const std::string& aComponentNam
 _PTR(SComponent) SALOMEDS_Study::FindComponentID(const std::string& aComponentID)
 {  
   SALOMEDSClient_SComponent* aSCO = NULL;
-  if(_isLocal) {
-    Handle(SALOMEDSImpl_SComponent) aSCO_impl =_local_impl->FindComponentID((char*)aComponentID.c_str());
-    if(aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
+    Handle(SALOMEDSImpl_SComponent) aSCO_impl =
+      _local_impl->FindComponentID((char*)aComponentID.c_str());
+    if (aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO);
     aSCO = new SALOMEDS_SComponent(aSCO_impl);
   }
   else {
@@ -149,57 +167,64 @@ _PTR(SComponent) SALOMEDS_Study::FindComponentID(const std::string& aComponentID
     aSCO = new SALOMEDS_SComponent(aSCO_impl);
   }
   return _PTR(SComponent)(aSCO);
-  
 }
  
 _PTR(SObject) SALOMEDS_Study::FindObject(const std::string& anObjectName)
 {
   SALOMEDSClient_SObject* aSO = NULL;
 
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObject((char*)anObjectName.c_str());
-    if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
+    if (aSO_impl.IsNull()) return _PTR(SObject)(aSO);
     Handle(SALOMEDSImpl_SComponent) aSCO_impl = Handle(SALOMEDSImpl_SComponent)::DownCast(aSO_impl);
-    if(!aSCO_impl.IsNull()) return _PTR(SObject)(new SALOMEDS_SComponent(aSCO_impl));
+    if (!aSCO_impl.IsNull()) return _PTR(SObject)(new SALOMEDS_SComponent(aSCO_impl));
     aSO = new SALOMEDS_SObject(aSO_impl);
   }
   else { 
     SALOMEDS::SObject_var aSO_impl = _corba_impl->FindObject((char*)anObjectName.c_str());
-    if(CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO);
+    if (CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO);
     SALOMEDS::SComponent_var aSCO_impl = SALOMEDS::SComponent::_narrow(aSO_impl);
-    if(!CORBA::is_nil(aSCO_impl)) return _PTR(SObject)(new SALOMEDS_SComponent(aSCO_impl));
+    if (!CORBA::is_nil(aSCO_impl)) return _PTR(SObject)(new SALOMEDS_SComponent(aSCO_impl));
     aSO = new SALOMEDS_SObject(aSO_impl);
   }
 
   return _PTR(SObject)(aSO);
 }
+
 std::vector<_PTR(SObject)> SALOMEDS_Study::FindObjectByName(const std::string& anObjectName, 
-                                                                     const std::string& aComponentName)   
+                                                            const std::string& aComponentName)   
 {
   std::vector<_PTR(SObject)> aVector;
   int i, aLength = 0;
-  
-  if(_isLocal) {
-    Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->FindObjectByName((char*)anObjectName.c_str(), (char*)aComponentName.c_str());
+
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
+    Handle(TColStd_HSequenceOfTransient) aSeq =
+      _local_impl->FindObjectByName((char*)anObjectName.c_str(), (char*)aComponentName.c_str());
     aLength = aSeq->Length();
-    for(i = 1; i<= aLength; i++) 
-      aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)))));
+    for (i = 1; i<= aLength; i++) 
+      aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject
+                                      (Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)))));
   }
   else {
     SALOMEDS::Study::ListOfSObject_var aSeq = _corba_impl->FindObjectByName((char*)anObjectName.c_str(), 
                                                                            (char*)aComponentName.c_str());
     aLength = aSeq->length();
-    for(i = 0; i< aLength; i++) aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject(aSeq[i])));
+    for (i = 0; i< aLength; i++) aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject(aSeq[i])));
   }
 
   return aVector;
 }
+
 _PTR(SObject) SALOMEDS_Study::FindObjectID(const std::string& anObjectID)
 {
   SALOMEDSClient_SObject* aSO = NULL;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectID((char*)anObjectID.c_str());
     if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
     return _PTR(SObject)(new SALOMEDS_SObject(aSO_impl));
@@ -215,22 +240,27 @@ _PTR(SObject) SALOMEDS_Study::FindObjectID(const std::string& anObjectID)
 _PTR(SObject) SALOMEDS_Study::CreateObjectID(const std::string& anObjectID)
 {
   SALOMEDSClient_SObject* aSO = NULL;
-  if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->CreateObjectID((char*)anObjectID.c_str()));
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aSO = new SALOMEDS_SObject(_local_impl->CreateObjectID((char*)anObjectID.c_str()));
+  }
   else aSO = new SALOMEDS_SObject(_corba_impl->CreateObjectID((char*)anObjectID.c_str())); 
   return _PTR(SObject)(aSO);
 }
+
 _PTR(SObject) SALOMEDS_Study::FindObjectIOR(const std::string& anObjectIOR)
 {
   SALOMEDSClient_SObject* aSO = NULL;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectIOR((char*)anObjectIOR.c_str());
-    if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
+    if (aSO_impl.IsNull()) return _PTR(SObject)(aSO);
     aSO = new SALOMEDS_SObject(aSO_impl);
   }
   else { 
     SALOMEDS::SObject_var aSO_impl = _corba_impl->FindObjectIOR((char*)anObjectIOR.c_str());
-    if(CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO);
+    if (CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO);
     aSO = new SALOMEDS_SObject(aSO_impl);
   }
   return _PTR(SObject)(aSO);
@@ -239,14 +269,16 @@ _PTR(SObject) SALOMEDS_Study::FindObjectIOR(const std::string& anObjectIOR)
 _PTR(SObject) SALOMEDS_Study::FindObjectByPath(const std::string& thePath)
 {
   SALOMEDSClient_SObject* aSO = NULL;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectByPath((char*)thePath.c_str());
-    if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
+    if (aSO_impl.IsNull()) return _PTR(SObject)(aSO);
     aSO = new SALOMEDS_SObject(aSO_impl);
   }
   else {
     SALOMEDS::SObject_var aSO_impl = _corba_impl->FindObjectByPath((char*)thePath.c_str());
-    if(CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO);
+    if (CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO);
     aSO = new SALOMEDS_SObject(aSO_impl);
   }
   return _PTR(SObject)(aSO);
@@ -256,21 +288,30 @@ std::string SALOMEDS_Study::GetObjectPath(const _PTR(SObject)& theSO)
 {
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
   std::string aPath;
-  if(_isLocal) aPath = _local_impl->GetObjectPath(aSO->GetLocalImpl()).ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aPath = _local_impl->GetObjectPath(aSO->GetLocalImpl()).ToCString();
+  }
   else aPath = _corba_impl->GetObjectPath(aSO->GetCORBAImpl());
   return aPath;
 }
 
 void SALOMEDS_Study::SetContext(const std::string& thePath)
 {
-  if(_isLocal) _local_impl->SetContext((char*)thePath.c_str());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    _local_impl->SetContext((char*)thePath.c_str());
+  }
   else _corba_impl->SetContext((char*)thePath.c_str());
 }
 
 std::string SALOMEDS_Study::GetContext()  
 {
   std::string aPath;
-  if(_isLocal) aPath = _local_impl->GetContext().ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aPath = _local_impl->GetContext().ToCString();
+  }
   else aPath = _corba_impl->GetContext();
   return aPath;
 }
@@ -279,15 +320,17 @@ std::vector<std::string> SALOMEDS_Study::GetObjectNames(const std::string& theCo
 {
   std::vector<std::string> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetObjectNames((char*)theContext.c_str());
     aLength = aSeq->Length();
-    for(i = 1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
+    for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
   }
   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()));
+    for (i = 0; i < aLength; i++) aVector.push_back(std::string((std::string)aSeq[i].in()));
   }
   return aVector;
 }
@@ -296,15 +339,18 @@ std::vector<std::string> SALOMEDS_Study::GetDirectoryNames(const std::string& th
 {
   std::vector<std::string> aVector;
   int aLength, i;
-  if(_isLocal) {
-    Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetDirectoryNames((char*)theContext.c_str());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
+    Handle(TColStd_HSequenceOfAsciiString) aSeq =
+      _local_impl->GetDirectoryNames((char*)theContext.c_str());
     aLength = aSeq->Length();
-    for(i = 1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
+    for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
   }
   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());
+    for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in());
   }
   return aVector;
 }
@@ -313,16 +359,18 @@ std::vector<std::string> SALOMEDS_Study::GetFileNames(const std::string& theCont
 {
   std::vector<std::string> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetFileNames((char*)theContext.c_str());
     aLength = aSeq->Length();
-    for(i = 1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
+    for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
   }
   else {
     SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetFileNames((char*)theContext.c_str());
     aLength = aSeq->length();
 
-    for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+    for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in());
   }
   return aVector;
 }
@@ -331,15 +379,17 @@ std::vector<std::string> SALOMEDS_Study::GetComponentNames(const std::string& th
 {
   std::vector<std::string> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetComponentNames((char*)theContext.c_str());
     aLength = aSeq->Length();
-    for(i = 1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
+    for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
   }
   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());
+    for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in());
   }
   return aVector;
 }
@@ -348,7 +398,9 @@ _PTR(ChildIterator) SALOMEDS_Study::NewChildIterator(const _PTR(SObject)& theSO)
 {
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
   SALOMEDSClient_ChildIterator* aCI = NULL; 
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_ChildIterator) aCIimpl = _local_impl->NewChildIterator(aSO->GetLocalImpl());
     aCI = new SALOMEDS_ChildIterator(aCIimpl);
   }
@@ -363,7 +415,9 @@ _PTR(ChildIterator) SALOMEDS_Study::NewChildIterator(const _PTR(SObject)& theSO)
 _PTR(SComponentIterator) SALOMEDS_Study::NewComponentIterator()
 {
   SALOMEDSClient_SComponentIterator* aCI = NULL; 
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     SALOMEDSImpl_SComponentIterator aCIimpl = _local_impl->NewComponentIterator();
     aCI = new SALOMEDS_SComponentIterator(aCIimpl);
   }
@@ -374,11 +428,13 @@ _PTR(SComponentIterator) SALOMEDS_Study::NewComponentIterator()
 
   return _PTR(SComponentIterator)(aCI);
 }
+
 _PTR(StudyBuilder) SALOMEDS_Study::NewBuilder()
 {
   SALOMEDSClient_StudyBuilder* aSB = NULL; 
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_StudyBuilder) aSBimpl = _local_impl->NewBuilder();
     aSB = new SALOMEDS_StudyBuilder(aSBimpl);
   }
@@ -393,35 +449,50 @@ _PTR(StudyBuilder) SALOMEDS_Study::NewBuilder()
 std::string SALOMEDS_Study::Name()
 {
   std::string aName;
-  if(_isLocal) aName = _local_impl->Name().ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aName = _local_impl->Name().ToCString();
+  }
   else aName = _corba_impl->Name();
   return aName;
 }
+
 void SALOMEDS_Study::Name(const std::string& theName)
 {
-  if(_isLocal) _local_impl->Name((char*)theName.c_str());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    _local_impl->Name((char*)theName.c_str());
+  }
   else _corba_impl->Name((char*)theName.c_str());
 }
 
 bool SALOMEDS_Study::IsSaved()
 {
   bool isSaved;
-  if(_isLocal) isSaved = _local_impl->IsSaved();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    isSaved = _local_impl->IsSaved();
+  }
   else isSaved = _corba_impl->IsSaved();
   return isSaved;
 }
 
 void SALOMEDS_Study::IsSaved(bool save)
 {
-  if(_isLocal) _local_impl->IsSaved(save);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    _local_impl->IsSaved(save);
+  }
   else _corba_impl->IsSaved(save);
 }
 
 bool SALOMEDS_Study::IsModified()
 {
   bool isModified;
-  if(_isLocal) isModified = _local_impl->IsModified();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    isModified = _local_impl->IsModified();
+  }
   else isModified = _corba_impl->IsModified();
   return isModified;
 }
@@ -429,28 +500,40 @@ bool SALOMEDS_Study::IsModified()
 std::string SALOMEDS_Study::URL()
 {
   std::string aURL;
-  if(_isLocal) aURL = _local_impl->URL().ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aURL = _local_impl->URL().ToCString();
+  }
   else aURL = _corba_impl->URL();
   return aURL;
 }
 
 void SALOMEDS_Study::URL(const std::string& url)
 {
-  if(_isLocal) _local_impl->URL((char*)url.c_str());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    _local_impl->URL((char*)url.c_str());
+  }
   else _corba_impl->URL((char*)url.c_str());
 }
 
 int SALOMEDS_Study::StudyId()
 {
   int anID;
-  if(_isLocal) anID = _local_impl->StudyId();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    anID = _local_impl->StudyId();
+  }
   else anID = _corba_impl->StudyId();
   return anID;
 }
  
 void SALOMEDS_Study::StudyId(int id) 
 {
-  if(_isLocal) _local_impl->StudyId(id);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    _local_impl->StudyId(id);
+  }
   else _corba_impl->StudyId(id);  
 }
 
@@ -459,12 +542,13 @@ std::vector<_PTR(SObject)> SALOMEDS_Study::FindDependances(const _PTR(SObject)&
   std::vector<_PTR(SObject)> aVector;
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->FindDependances(aSO->GetLocalImpl());
-    if ( !aSeq.IsNull() )
-    {
+    if (!aSeq.IsNull()) {
       aLength = aSeq->Length();
-      for(i=1; i<=aLength; i++) 
+      for (i = 1; i <= aLength; i++) 
         aVector.push_back(_PTR(SObject)(
           new SALOMEDS_SObject(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)))));
     }
@@ -472,7 +556,7 @@ std::vector<_PTR(SObject)> SALOMEDS_Study::FindDependances(const _PTR(SObject)&
   else {
     SALOMEDS::Study::ListOfSObject_var aSeq = _corba_impl->FindDependances(aSO->GetCORBAImpl());
     aLength = aSeq->length();
-    for(i=0; i<aLength; i++) aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject(aSeq[i])));
+    for (i = 0; i < aLength; i++) aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject(aSeq[i])));
   }
   return aVector;
 }
@@ -480,7 +564,10 @@ std::vector<_PTR(SObject)> SALOMEDS_Study::FindDependances(const _PTR(SObject)&
 _PTR(AttributeStudyProperties) SALOMEDS_Study::GetProperties()
 {
   SALOMEDSClient_AttributeStudyProperties* aProp;
-  if(_isLocal) aProp = new SALOMEDS_AttributeStudyProperties(_local_impl->GetProperties());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aProp = new SALOMEDS_AttributeStudyProperties(_local_impl->GetProperties());
+  }
   else aProp = new SALOMEDS_AttributeStudyProperties(_corba_impl->GetProperties());
   return _PTR(AttributeStudyProperties)(aProp);
 }
@@ -488,7 +575,10 @@ _PTR(AttributeStudyProperties) SALOMEDS_Study::GetProperties()
 std::string SALOMEDS_Study::GetLastModificationDate() 
 {
   std::string aDate;
-  if(_isLocal) aDate = _local_impl->GetLastModificationDate().ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aDate = _local_impl->GetLastModificationDate().ToCString();
+  }
   else aDate = _corba_impl->GetLastModificationDate();
   return aDate;
 }
@@ -497,15 +587,17 @@ std::vector<std::string> SALOMEDS_Study::GetModificationsDate()
 {
   std::vector<std::string> aVector;
   int aLength, i;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetModificationsDate();
     aLength = aSeq->Length();
-    for(i=1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
+    for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
   }
   else {
     SALOMEDS::ListOfDates_var aSeq = _corba_impl->GetModificationsDate();
     aLength = aSeq->length();
-    for(i=0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+    for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in());
   }
   return aVector;
 }
@@ -513,7 +605,9 @@ std::vector<std::string> SALOMEDS_Study::GetModificationsDate()
 _PTR(UseCaseBuilder) SALOMEDS_Study::GetUseCaseBuilder()
 {
   SALOMEDSClient_UseCaseBuilder* aUB = NULL;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_UseCaseBuilder) aUBimpl = _local_impl->GetUseCaseBuilder();
     aUB = new SALOMEDS_UseCaseBuilder(aUBimpl);
   }
@@ -527,7 +621,10 @@ _PTR(UseCaseBuilder) SALOMEDS_Study::GetUseCaseBuilder()
 
 void SALOMEDS_Study::Close()
 {
-  if(_isLocal) _local_impl->Close();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    _local_impl->Close();
+  }
   else _corba_impl->Close();
 }
 
@@ -539,13 +636,8 @@ void SALOMEDS_Study::EnableUseCaseAutoFilling(bool isEnabled)
 
 bool SALOMEDS_Study::DumpStudy(const std::string& thePath, const std::string& theBaseName, bool isPublished)
 {
-  bool ret;
-  if(_isLocal) {
-    SALOMEDS_DriverFactory_i* aFactory = new SALOMEDS_DriverFactory_i(_orb);
-    ret = _local_impl->DumpStudy((char*)thePath.c_str(), (char*)theBaseName.c_str(), isPublished, aFactory);
-    delete aFactory;
-  }
-  else ret = _corba_impl->DumpStudy((char*)thePath.c_str(), (char*)theBaseName.c_str(), isPublished);
+  //SRN: Pure CORBA DumpStudy as it does more cleaning than the local one
+  bool ret = _corba_impl->DumpStudy((char*)thePath.c_str(), (char*)theBaseName.c_str(), isPublished);
   return ret;
 }     
 
@@ -568,11 +660,13 @@ void SALOMEDS_Study::init_orb()
 
 SALOMEDS::Study_ptr SALOMEDS_Study::GetStudy()
 {
-  if(_isLocal) {
-    if(!CORBA::is_nil(_corba_impl)) return _corba_impl;
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
+    if (!CORBA::is_nil(_corba_impl)) return _corba_impl;
     std::string anIOR = _local_impl->GetTransientReference().ToCString();
     SALOMEDS::Study_var aStudy;
-    if(!_local_impl->IsError() && anIOR != "") {
+    if (!_local_impl->IsError() && anIOR != "") {
       aStudy = SALOMEDS::Study::_narrow(_orb->string_to_object(anIOR.c_str()));
     }
     else {
@@ -585,6 +679,6 @@ SALOMEDS::Study_ptr SALOMEDS_Study::GetStudy()
   else {
     return _corba_impl;
   }
-   
+
   return SALOMEDS::Study::_nil();
 }
index 045fdea8d99fd2bc2d5f7ab606a4d462552d3fd1..e11a77eb498a0d41f83270d5780b8aa81766eacd 100644 (file)
 #include "utilities.h"
 
 #include "SALOMEDS_StudyBuilder.hxx"
+
+#include "SALOMEDS.hxx"
 #include "SALOMEDS_SObject.hxx"
-#include "SALOMEDSImpl_SObject.hxx"
 #include "SALOMEDS_SComponent.hxx"
-#include "SALOMEDSImpl_SComponent.hxx"
-#include "SALOMEDS_Driver_i.hxx"
 #include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDS_StudyManager.hxx"
+
+#include "SALOMEDS_Driver_i.hxx"
+
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_SComponent.hxx"
 #include "SALOMEDSImpl_GenericAttribute.hxx"
+
 #include <string>
+
 #include <TCollection_AsciiString.hxx> 
 #include <TDF_Attribute.hxx>
-#include "SALOMEDS_StudyManager.hxx"
 
 #include "Utils_CorbaException.hxx"
 #include "Utils_ORB_INIT.hxx" 
@@ -68,11 +74,12 @@ SALOMEDS_StudyBuilder::~SALOMEDS_StudyBuilder()
 
 _PTR(SComponent) SALOMEDS_StudyBuilder::NewComponent(const std::string& ComponentDataType)
 {
-  CheckLocked();
-
   SALOMEDSClient_SComponent* aSCO = NULL;
-  
-  if(_isLocal) {
+
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_SComponent) aSCO_impl =_local_impl->NewComponent((char*)ComponentDataType.c_str());
     if(aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO);
     aSCO = new SALOMEDS_SComponent(aSCO_impl);
@@ -82,18 +89,21 @@ _PTR(SComponent) SALOMEDS_StudyBuilder::NewComponent(const std::string& Componen
     if(CORBA::is_nil(aSCO_impl)) return _PTR(SComponent)(aSCO);
     aSCO = new SALOMEDS_SComponent(aSCO_impl);
   }
+
   return _PTR(SComponent)(aSCO);
 }
 
 void SALOMEDS_StudyBuilder::DefineComponentInstance (const _PTR(SComponent)& theSCO, 
                                                     const std::string& ComponentIOR)
 {
-  CheckLocked();
-
   SALOMEDS_SComponent* aSCO = dynamic_cast<SALOMEDS_SComponent*>(theSCO.get());
-  if(_isLocal) _local_impl->DefineComponentInstance(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()),
-                                                    (char*)ComponentIOR.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+
+    _local_impl->DefineComponentInstance(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()),
+                                         (char*)ComponentIOR.c_str());
+  }
   else {
     CORBA::Object_var obj = _orb->string_to_object(ComponentIOR.c_str());
     _corba_impl->DefineComponentInstance(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl()), obj);
@@ -102,10 +112,13 @@ void SALOMEDS_StudyBuilder::DefineComponentInstance (const _PTR(SComponent)& the
 
 void SALOMEDS_StudyBuilder::RemoveComponent(const _PTR(SComponent)& theSCO)
 {
-  CheckLocked();
-
   SALOMEDS_SComponent* aSCO = dynamic_cast<SALOMEDS_SComponent*>(theSCO.get());
-  if(_isLocal) _local_impl->RemoveComponent(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()));
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+
+    _local_impl->RemoveComponent(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()));
+  }
   else _corba_impl->RemoveComponent(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl()));
 }
 
@@ -115,8 +128,10 @@ _PTR(SObject) SALOMEDS_StudyBuilder::NewObject(const _PTR(SObject)& theFatherObj
 
   SALOMEDSClient_SObject* aSO = NULL;
   SALOMEDS_SObject* father = dynamic_cast< SALOMEDS_SObject*>(theFatherObject.get());
-  if(father == NULL) return _PTR(SObject)(aSO);
-  if(_isLocal) {
+  if (father == NULL) return _PTR(SObject)(aSO);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->NewObject(father->GetLocalImpl());
     if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
     aSO = new SALOMEDS_SObject(aSO_impl);
@@ -136,8 +151,10 @@ _PTR(SObject) SALOMEDS_StudyBuilder::NewObjectToTag(const _PTR(SObject)& theFath
 
   SALOMEDSClient_SObject* aSO = NULL;
   SALOMEDS_SObject* father = dynamic_cast< SALOMEDS_SObject*>(theFatherObject.get());
-  if(father == NULL) return _PTR(SObject)(aSO);
-  if(_isLocal) {
+  if (father == NULL) return _PTR(SObject)(aSO);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->NewObjectToTag(father->GetLocalImpl(), theTag);
     if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
     aSO = new SALOMEDS_SObject(aSO_impl);
@@ -149,20 +166,20 @@ _PTR(SObject) SALOMEDS_StudyBuilder::NewObjectToTag(const _PTR(SObject)& theFath
   }
 
   return _PTR(SObject)(aSO);
-  
 }
 
 void SALOMEDS_StudyBuilder::AddDirectory(const std::string& thePath)
 {
-  CheckLocked();
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
 
-  if(_isLocal) {
     _local_impl->AddDirectory((char*)thePath.c_str());
-    if(_local_impl->IsError()) {
+    if (_local_impl->IsError()) {
       std::string anErrorCode = _local_impl->GetErrorCode().ToCString();
-      if(anErrorCode == "StudyNameAlreadyUsed") throw SALOMEDS::Study::StudyNameAlreadyUsed(); 
-      if(anErrorCode == "StudyInvalidDirectory") throw SALOMEDS::Study::StudyInvalidDirectory(); 
-      if(anErrorCode == "StudyInvalidComponent") throw SALOMEDS::Study::StudyInvalidComponent();  
+      if (anErrorCode == "StudyNameAlreadyUsed")  throw SALOMEDS::Study::StudyNameAlreadyUsed(); 
+      if (anErrorCode == "StudyInvalidDirectory") throw SALOMEDS::Study::StudyInvalidDirectory(); 
+      if (anErrorCode == "StudyInvalidComponent") throw SALOMEDS::Study::StudyInvalidComponent();  
     }
   }
   else _corba_impl->AddDirectory((char*)thePath.c_str());
@@ -174,9 +191,12 @@ void SALOMEDS_StudyBuilder::LoadWith(const _PTR(SComponent)& theSCO, const std::
   CORBA::Object_var obj = _orb->string_to_object(theIOR.c_str());
   SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj);
   
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     SALOMEDS_Driver_i* drv = new SALOMEDS_Driver_i(aDriver, _orb);    
-    Handle(SALOMEDSImpl_SComponent) aSCO_impl = Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl());
+    Handle(SALOMEDSImpl_SComponent) aSCO_impl =
+      Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl());
     bool isDone = _local_impl->LoadWith(aSCO_impl, drv);
     delete drv;
     if(!isDone && _local_impl->IsError()) 
@@ -190,46 +210,55 @@ void SALOMEDS_StudyBuilder::LoadWith(const _PTR(SComponent)& theSCO, const std::
 void SALOMEDS_StudyBuilder::Load(const _PTR(SObject)& theSCO)
 {
   SALOMEDS_SComponent* aSCO = dynamic_cast<SALOMEDS_SComponent*>(theSCO.get());
-  if(_isLocal) _local_impl->Load(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()));
+  if (_isLocal) _local_impl->Load(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()));
   else _corba_impl->Load(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl()));
 }
 
 void SALOMEDS_StudyBuilder::RemoveObject(const _PTR(SObject)& theSO)
 {
-  CheckLocked();
-
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
-  if(_isLocal) _local_impl->RemoveObject(aSO->GetLocalImpl());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+
+    _local_impl->RemoveObject(aSO->GetLocalImpl());
+  }
   else _corba_impl->RemoveObject(aSO->GetCORBAImpl());
 }
 
 void SALOMEDS_StudyBuilder::RemoveObjectWithChildren(const _PTR(SObject)& theSO)
 {
-  CheckLocked();
-
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
-  if(_isLocal) _local_impl->RemoveObjectWithChildren(aSO->GetLocalImpl());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+
+    _local_impl->RemoveObjectWithChildren(aSO->GetLocalImpl());
+  }
   else _corba_impl->RemoveObjectWithChildren(aSO->GetCORBAImpl());
 }
+
 _PTR(GenericAttribute) SALOMEDS_StudyBuilder::FindOrCreateAttribute(const _PTR(SObject)& theSO, 
                                                                    const std::string& aTypeOfAttribute)
 {
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
   SALOMEDSClient_GenericAttribute* anAttr = NULL;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_GenericAttribute) aGA;
     try {
-      aGA=Handle(SALOMEDSImpl_GenericAttribute)::DownCast(_local_impl->FindOrCreateAttribute(aSO->GetLocalImpl(),
-                                                                                             (char*)aTypeOfAttribute.c_str()));
-     }
+      aGA = Handle(SALOMEDSImpl_GenericAttribute)::DownCast
+        (_local_impl->FindOrCreateAttribute(aSO->GetLocalImpl(), (char*)aTypeOfAttribute.c_str()));
+    }
     catch (...) {
       throw SALOMEDS::StudyBuilder::LockProtection();
-    }  
+    }
     anAttr = SALOMEDS_GenericAttribute::CreateAttribute(aGA);
   }
   else {
-    SALOMEDS::GenericAttribute_var aGA = _corba_impl->FindOrCreateAttribute(aSO->GetCORBAImpl(), (char*)aTypeOfAttribute.c_str());
+    SALOMEDS::GenericAttribute_var aGA =
+      _corba_impl->FindOrCreateAttribute(aSO->GetCORBAImpl(), (char*)aTypeOfAttribute.c_str());
     anAttr = SALOMEDS_GenericAttribute::CreateAttribute(aGA);
   }
 
@@ -242,7 +271,9 @@ bool SALOMEDS_StudyBuilder::FindAttribute(const _PTR(SObject)& theSO,
 {
   bool ret;
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_GenericAttribute) aGA;
     ret = _local_impl->FindAttribute(aSO->GetLocalImpl(), aGA, (char*)aTypeOfAttribute.c_str());
     if(ret) anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(aGA));
@@ -255,41 +286,53 @@ bool SALOMEDS_StudyBuilder::FindAttribute(const _PTR(SObject)& theSO,
 
   return ret;
 }
+
 void SALOMEDS_StudyBuilder::RemoveAttribute(const _PTR(SObject)& theSO, const std::string& aTypeOfAttribute)
 {
-  CheckLocked();
-
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
-  if(_isLocal) _local_impl->RemoveAttribute(aSO->GetLocalImpl(), (char*)aTypeOfAttribute.c_str());
-  else _corba_impl->RemoveAttribute(aSO->GetCORBAImpl(), (char*)aTypeOfAttribute.c_str()); 
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+
+    _local_impl->RemoveAttribute(aSO->GetLocalImpl(), (char*)aTypeOfAttribute.c_str());
+  }
+  else _corba_impl->RemoveAttribute(aSO->GetCORBAImpl(), (char*)aTypeOfAttribute.c_str());
 }
 
 void SALOMEDS_StudyBuilder::Addreference(const _PTR(SObject)& me, const _PTR(SObject)& thereferencedObject)
 {
-  CheckLocked();
-
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(me.get());
   SALOMEDS_SObject* aRefSO = dynamic_cast<SALOMEDS_SObject*>(thereferencedObject.get());
-  if(_isLocal) _local_impl->Addreference(aSO->GetLocalImpl(), aRefSO->GetLocalImpl());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+
+    _local_impl->Addreference(aSO->GetLocalImpl(), aRefSO->GetLocalImpl());
+  }
   else _corba_impl->Addreference(aSO->GetCORBAImpl(), aRefSO->GetCORBAImpl());
 }
 
 void SALOMEDS_StudyBuilder::RemoveReference(const _PTR(SObject)& me)
 {
-  CheckLocked();
-
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(me.get());
-  if(_isLocal) _local_impl->RemoveReference(aSO->GetLocalImpl());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+
+    _local_impl->RemoveReference(aSO->GetLocalImpl());
+  }
   else _corba_impl->RemoveReference(aSO->GetCORBAImpl());
 }
 
 void SALOMEDS_StudyBuilder::SetGUID(const _PTR(SObject)& theSO, const std::string& theGUID)
 {
-  CheckLocked();
-
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
-  if(_isLocal) _local_impl->SetGUID(aSO->GetLocalImpl(), (char*)theGUID.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+
+    _local_impl->SetGUID(aSO->GetLocalImpl(), (char*)theGUID.c_str());
+  }
   else _corba_impl->SetGUID(aSO->GetCORBAImpl(), (char*)theGUID.c_str());
 }
  
@@ -297,7 +340,11 @@ bool SALOMEDS_StudyBuilder::IsGUID(const _PTR(SObject)& theSO, const std::string
 {
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
   bool ret;
-  if(_isLocal) ret = _local_impl->IsGUID(aSO->GetLocalImpl(), (char*)theGUID.c_str());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
+    ret = _local_impl->IsGUID(aSO->GetLocalImpl(), (char*)theGUID.c_str());
+  }
   else ret = _corba_impl->IsGUID(aSO->GetCORBAImpl(), (char*)theGUID.c_str());
 
   return ret;
@@ -305,13 +352,17 @@ bool SALOMEDS_StudyBuilder::IsGUID(const _PTR(SObject)& theSO, const std::string
 
 void SALOMEDS_StudyBuilder::NewCommand()
 {
-  if(_isLocal) _local_impl->NewCommand();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    _local_impl->NewCommand();
+  }
   else _corba_impl->NewCommand();
 }
  
 void SALOMEDS_StudyBuilder::CommitCommand()
 {
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     try {
       _local_impl->CommitCommand();
     }
@@ -325,20 +376,27 @@ void SALOMEDS_StudyBuilder::CommitCommand()
 bool SALOMEDS_StudyBuilder::HasOpenCommand()
 {
   bool ret;
-  if(_isLocal) ret = _local_impl->HasOpenCommand();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = _local_impl->HasOpenCommand();
+  }
   else ret = _corba_impl->HasOpenCommand();
   return ret;
 }
 
 void SALOMEDS_StudyBuilder::AbortCommand()
 {
-  if(_isLocal) _local_impl->AbortCommand();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    _local_impl->AbortCommand();
+  }
   else _corba_impl->AbortCommand();
 }
 
 void SALOMEDS_StudyBuilder::Undo()
 {
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     try {
       _local_impl->Undo();
     }
@@ -348,10 +406,11 @@ void SALOMEDS_StudyBuilder::Undo()
   }
   else _corba_impl->Undo();
 }
+
 void SALOMEDS_StudyBuilder::Redo()
 {
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     try {
       _local_impl->Redo();
     }
@@ -361,11 +420,14 @@ void SALOMEDS_StudyBuilder::Redo()
   }
   else _corba_impl->Redo(); 
 }
+
 bool SALOMEDS_StudyBuilder::GetAvailableUndos()
 {
   bool ret;
-  if(_isLocal) ret = _local_impl->GetAvailableUndos();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = _local_impl->GetAvailableUndos();
+  }
   else ret = _corba_impl->GetAvailableUndos();
   return ret;
 }
@@ -373,7 +435,10 @@ bool SALOMEDS_StudyBuilder::GetAvailableUndos()
 bool SALOMEDS_StudyBuilder::GetAvailableRedos()
 {
   bool ret;
-  if(_isLocal) ret = _local_impl->GetAvailableRedos();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = _local_impl->GetAvailableRedos();
+  }
   else ret = _corba_impl->GetAvailableRedos();
   return ret; 
 }
@@ -381,23 +446,30 @@ bool SALOMEDS_StudyBuilder::GetAvailableRedos()
 int SALOMEDS_StudyBuilder::UndoLimit()
 {
   int aLimit;
-  if(_isLocal) aLimit = _local_impl->UndoLimit();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aLimit = _local_impl->UndoLimit();
+  }
   else aLimit = _corba_impl->UndoLimit();
   return aLimit;
 }
  
 void SALOMEDS_StudyBuilder::UndoLimit(int theLimit)
 {
-  CheckLocked();
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
 
-  if(_isLocal) _local_impl->UndoLimit(theLimit);
+    _local_impl->UndoLimit(theLimit);
+  }
   else _corba_impl->UndoLimit(theLimit);
 }
  
 void SALOMEDS_StudyBuilder::CheckLocked()
 {
   //There is only local part as CORBA part throws the correct exeception
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
     try {
       _local_impl->CheckLocked();
     }
@@ -409,34 +481,43 @@ void SALOMEDS_StudyBuilder::CheckLocked()
 
 void SALOMEDS_StudyBuilder::SetName(const _PTR(SObject)& theSO, const std::string& theValue)
 {
-  CheckLocked();
-
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
-  if(_isLocal) _local_impl->SetName(aSO->GetLocalImpl(), (char*)theValue.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+
+    _local_impl->SetName(aSO->GetLocalImpl(), (char*)theValue.c_str());
+  }
   else _corba_impl->SetName(aSO->GetCORBAImpl(), (char*)theValue.c_str());
 }
 
 void SALOMEDS_StudyBuilder::SetComment(const _PTR(SObject)& theSO, const std::string& theValue)
 {
-  CheckLocked();
-
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
-  if(_isLocal) _local_impl->SetComment(aSO->GetLocalImpl(), (char*)theValue.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+
+    _local_impl->SetComment(aSO->GetLocalImpl(), (char*)theValue.c_str());
+  }
   else _corba_impl->SetComment(aSO->GetCORBAImpl(), (char*)theValue.c_str());
 }
 
 void SALOMEDS_StudyBuilder::SetIOR(const _PTR(SObject)& theSO, const std::string& theValue)
 {
-  CheckLocked();
-
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
-  if(_isLocal) _local_impl->SetIOR(aSO->GetLocalImpl(), (char*)theValue.c_str());
+  if (_isLocal) {
+    CheckLocked();
+    SALOMEDS::Locker lock;
+
+    _local_impl->SetIOR(aSO->GetLocalImpl(), (char*)theValue.c_str());
+  }
   else _corba_impl->SetIOR(aSO->GetCORBAImpl(), (char*)theValue.c_str());
 }
 
 void SALOMEDS_StudyBuilder::init_orb()
 {
-  ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+  ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
   ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()); 
-  _orb = init(0 , 0 ) ;     
+  _orb = init(0 , 0 );     
 }
index 21d2551cd21d648059117424bc882f21456e4448..17e273f0e1ee937129c088162963ffa635deb73a 100644 (file)
 
 #include "SALOMEDS_StudyManager.hxx"
 
-#include "SALOMEDSImpl_Study.hxx"
+#include "SALOMEDS.hxx"
 #include "SALOMEDS_Study.hxx"
 #include "SALOMEDS_SObject.hxx"
+
 #include "SALOMEDS_Driver_i.hxx"
 
+#include "SALOMEDSImpl_Study.hxx"
+
 #include "Utils_ORB_INIT.hxx" 
 #include "Utils_SINGLETON.hxx" 
 
@@ -45,7 +48,7 @@
 
 #include "OpUtil.hxx"
 
-using namespace std; 
+using namespace std;
 
 SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb);
 
@@ -107,7 +110,7 @@ _PTR(Study) SALOMEDS_StudyManager::NewStudy(const std::string& study_name)
   SALOMEDSClient_Study* aStudy = NULL;
 
   SALOMEDS::Study_var aStudy_impl = _corba_impl->NewStudy((char*)study_name.c_str());
-  if(CORBA::is_nil(aStudy_impl)) return _PTR(Study)(aStudy); 
+  if(CORBA::is_nil(aStudy_impl)) return _PTR(Study)(aStudy);
   aStudy = new SALOMEDS_Study(aStudy_impl);
 
   return _PTR(Study)(aStudy);
@@ -119,7 +122,7 @@ _PTR(Study) SALOMEDS_StudyManager::Open(const std::string& theStudyUrl)
   SALOMEDSClient_Study* aStudy = NULL;
 
   SALOMEDS::Study_var aStudy_impl = _corba_impl->Open((char*)theStudyUrl.c_str());
-  if(CORBA::is_nil(aStudy_impl)) return  _PTR(Study)(aStudy); 
+  if(CORBA::is_nil(aStudy_impl)) return  _PTR(Study)(aStudy);
     
   aStudy = new SALOMEDS_Study(aStudy_impl.in());
 
@@ -133,32 +136,32 @@ void SALOMEDS_StudyManager::Close(const _PTR(Study)& theStudy)
   _corba_impl->Close(aStudy);
 }
  
-void SALOMEDS_StudyManager::Save(const _PTR(Study)& theStudy, bool theMultiFile)
+bool SALOMEDS_StudyManager::Save(const _PTR(Study)& theStudy, bool theMultiFile)
 {
   //SRN: Pure CORBA save as the save operation require CORBA in any case 
   SALOMEDS::Study_var aStudy = _corba_impl->GetStudyByID(theStudy->StudyId());
-  _corba_impl->Save(aStudy, theMultiFile);
+  return _corba_impl->Save(aStudy, theMultiFile);
 }
  
-void SALOMEDS_StudyManager::SaveASCII(const _PTR(Study)& theStudy, bool theMultiFile)
+bool SALOMEDS_StudyManager::SaveASCII(const _PTR(Study)& theStudy, bool theMultiFile)
 {
   //SRN: Pure CORBA save as the save operation require CORBA in any case 
   SALOMEDS::Study_var aStudy = _corba_impl->GetStudyByID(theStudy->StudyId());
-  _corba_impl->SaveASCII(aStudy, theMultiFile);
+  return _corba_impl->SaveASCII(aStudy, theMultiFile);
 }
  
-void SALOMEDS_StudyManager::SaveAs(const std::string& theUrl,  const _PTR(Study)& theStudy, bool theMultiFile)
+bool SALOMEDS_StudyManager::SaveAs(const std::string& theUrl,  const _PTR(Study)& theStudy, bool theMultiFile)
 {
   //SRN: Pure CORBA save as the save operation require CORBA in any case 
   SALOMEDS::Study_var aStudy = _corba_impl->GetStudyByID(theStudy->StudyId());
-  _corba_impl->SaveAs((char*)theUrl.c_str(), aStudy, theMultiFile);
+  return _corba_impl->SaveAs((char*)theUrl.c_str(), aStudy, theMultiFile);
 }
  
-void SALOMEDS_StudyManager::SaveAsASCII(const std::string& theUrl,  const _PTR(Study)& theStudy, bool theMultiFile)
+bool SALOMEDS_StudyManager::SaveAsASCII(const std::string& theUrl,  const _PTR(Study)& theStudy, bool theMultiFile)
 {
   //SRN: Pure CORBA save as the save operation require CORBA in any case 
   SALOMEDS::Study_var aStudy = _corba_impl->GetStudyByID(theStudy->StudyId());
-  _corba_impl->SaveAsASCII((char*)theUrl.c_str(), aStudy, theMultiFile);
+  return _corba_impl->SaveAsASCII((char*)theUrl.c_str(), aStudy, theMultiFile);
 }
 
 std::vector<std::string> SALOMEDS_StudyManager::GetOpenStudies()
@@ -166,7 +169,9 @@ std::vector<std::string> SALOMEDS_StudyManager::GetOpenStudies()
   std::vector<std::string> aVector;
   int aLength, i;
 
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->GetOpenStudies();
     aLength = aSeq->Length();
     for(i = 1; i <= aLength; i++) 
@@ -180,18 +185,20 @@ std::vector<std::string> SALOMEDS_StudyManager::GetOpenStudies()
   }
   return aVector;
 }
+
 _PTR(Study) SALOMEDS_StudyManager::GetStudyByName(const std::string& theStudyName) 
 {
   SALOMEDSClient_Study* aStudy = NULL;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_Study) aStudy_impl = _local_impl->GetStudyByName((char*)theStudyName.c_str());
     if(aStudy_impl.IsNull()) return _PTR(Study)(aStudy);
     aStudy = new SALOMEDS_Study(aStudy_impl);
   }
   else  {
     SALOMEDS::Study_var aStudy_impl = _corba_impl->GetStudyByName((char*)theStudyName.c_str());
-    if(CORBA::is_nil(aStudy_impl)) return _PTR(Study)(aStudy); 
+    if(CORBA::is_nil(aStudy_impl)) return _PTR(Study)(aStudy);
     aStudy = new SALOMEDS_Study(aStudy_impl);
   }
   return _PTR(Study)(aStudy);
@@ -200,25 +207,29 @@ _PTR(Study) SALOMEDS_StudyManager::GetStudyByName(const std::string& theStudyNam
 _PTR(Study) SALOMEDS_StudyManager::GetStudyByID(int theStudyID) 
 {
   SALOMEDSClient_Study* aStudy = NULL;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_Study) aStudy_impl = _local_impl->GetStudyByID(theStudyID);
     if(aStudy_impl.IsNull()) return _PTR(Study)(aStudy);
     aStudy = new SALOMEDS_Study(aStudy_impl);
   }
   else { 
     SALOMEDS::Study_var aStudy_impl = _corba_impl->GetStudyByID(theStudyID);
-    if(CORBA::is_nil(aStudy_impl)) return _PTR(Study)(aStudy); 
+    if(CORBA::is_nil(aStudy_impl)) return _PTR(Study)(aStudy);
     aStudy = new SALOMEDS_Study(aStudy_impl);
   }
-  return _PTR(Study)(aStudy); 
+  return _PTR(Study)(aStudy);
 }
+
 bool SALOMEDS_StudyManager::CanCopy(const _PTR(SObject)& theSO)
 {
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
   bool ret;
 
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_SObject) aSO_impl = aSO->GetLocalImpl();
     SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb);
     ret = _local_impl->CanCopy(aSO_impl, aDriver);
@@ -230,12 +241,14 @@ bool SALOMEDS_StudyManager::CanCopy(const _PTR(SObject)& theSO)
 
   return ret;
 }
+
 bool SALOMEDS_StudyManager::Copy(const _PTR(SObject)& theSO)
 {
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
   bool ret;
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_SObject) aSO_impl = aSO->GetLocalImpl();
     SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb);
     ret = _local_impl->Copy(aSO_impl, aDriver);
@@ -246,13 +259,15 @@ bool SALOMEDS_StudyManager::Copy(const _PTR(SObject)& theSO)
   }
   return ret;
 }
+
 bool SALOMEDS_StudyManager::CanPaste(const _PTR(SObject)& theSO)
 {
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
   bool ret;
 
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_SObject) aSO_impl = aSO->GetLocalImpl();
     SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb);
     ret = _local_impl->CanPaste(aSO_impl, aDriver);
@@ -264,13 +279,15 @@ bool SALOMEDS_StudyManager::CanPaste(const _PTR(SObject)& theSO)
 
   return ret;
 }
+
 _PTR(SObject) SALOMEDS_StudyManager::Paste(const _PTR(SObject)& theSO)
 {
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
   SALOMEDSClient_SObject* aResult = NULL;
 
-  if(_isLocal) {
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+
     Handle(SALOMEDSImpl_SObject) aSO_impl = aSO->GetLocalImpl();
     SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb);
     Handle(SALOMEDSImpl_SObject) aNewSO = _local_impl->Paste(aSO_impl, aDriver);
@@ -290,9 +307,9 @@ _PTR(SObject) SALOMEDS_StudyManager::Paste(const _PTR(SObject)& theSO)
 
 void SALOMEDS_StudyManager::init_orb()
 {
-  ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
-  ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()); 
-  _orb = init(0 , 0 ) ;     
+  ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
+  ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
+  _orb = init(0 , 0 );
 }
 
 SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb)
@@ -307,7 +324,7 @@ SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORB
       SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ;
       driver = new SALOMEDS_Driver_i(Engine, orb);
     }
-  }  
+  }
 
   return driver;
 }
index 85303956454c99889f907d4f1d9215457c407cb7..8de05cf6f7e4506c3baab05dc385da1850529058 100644 (file)
@@ -52,10 +52,10 @@ public:
   virtual _PTR(Study) NewStudy(const std::string& study_name);
   virtual _PTR(Study) Open(const std::string& theStudyUrl);
   virtual void Close(const _PTR(Study)& theStudy);
-  virtual void Save(const _PTR(Study)& theStudy, bool theMultiFile);
-  virtual void SaveASCII(const _PTR(Study)& theStudy, bool theMultiFile);
-  virtual void SaveAs(const std::string& theUrl,  const _PTR(Study)& theStudy, bool theMultiFile);
-  virtual void SaveAsASCII(const std::string& theUrl,  const _PTR(Study)& theStudy, bool theMultiFile);
+  virtual bool Save(const _PTR(Study)& theStudy, bool theMultiFile);
+  virtual bool SaveASCII(const _PTR(Study)& theStudy, bool theMultiFile);
+  virtual bool SaveAs(const std::string& theUrl,  const _PTR(Study)& theStudy, bool theMultiFile);
+  virtual bool SaveAsASCII(const std::string& theUrl,  const _PTR(Study)& theStudy, bool theMultiFile);
   virtual std::vector<std::string> GetOpenStudies();
   virtual _PTR(Study) GetStudyByName(const std::string& theStudyName) ;
   virtual _PTR(Study) GetStudyByID(int theStudyID) ;
index cb1a066edfd7ec777b81e0ebae8de57d68fed48b..1bcaf8caa05b8e323aad1f724a23ec6fde43d7ec 100644 (file)
@@ -207,30 +207,30 @@ void SALOMEDS_StudyManager_i::Close(SALOMEDS::Study_ptr aStudy)
  *  Purpose  : Save a Study to it's persistent reference
  */
 //============================================================================
-void SALOMEDS_StudyManager_i::Save(SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile)
+CORBA::Boolean SALOMEDS_StudyManager_i::Save(SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile)
 {
   SALOMEDS::Locker lock;
 
   if(aStudy->_is_nil()) {
     MESSAGE("Save error: Study is null");
-    return;
+    return false;
   }
 
   Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
-  _impl->Save(aStudyImpl, _factory, theMultiFile);
+  return _impl->Save(aStudyImpl, _factory, theMultiFile);
 }
 
-void SALOMEDS_StudyManager_i::SaveASCII(SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile)
+CORBA::Boolean SALOMEDS_StudyManager_i::SaveASCII(SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile)
 {
   SALOMEDS::Locker lock;
 
   if(aStudy->_is_nil()) {
     MESSAGE("SaveASCII error: Study is null");
-    return;
+    return false;
   }
 
   Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
-  _impl->SaveASCII(aStudyImpl, _factory, theMultiFile);
+  return _impl->SaveASCII(aStudyImpl, _factory, theMultiFile);
 }
 
 //=============================================================================
@@ -238,30 +238,30 @@ void SALOMEDS_StudyManager_i::SaveASCII(SALOMEDS::Study_ptr aStudy, CORBA::Boole
  *  Purpose  : Save a study to the persistent reference aUrl
  */
 //============================================================================
-void SALOMEDS_StudyManager_i::SaveAs(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile)
+CORBA::Boolean SALOMEDS_StudyManager_i::SaveAs(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile)
 {
   SALOMEDS::Locker lock;
 
   if(aStudy->_is_nil()) {
     MESSAGE("SaveASCII error: Study is null");
-    return;
+    return false;
   }
 
   Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
-  _impl->SaveAs(TCollection_AsciiString((char*)aUrl), aStudyImpl, _factory, theMultiFile);
+  return _impl->SaveAs(TCollection_AsciiString((char*)aUrl), aStudyImpl, _factory, theMultiFile);
 }
 
-void SALOMEDS_StudyManager_i::SaveAsASCII(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile)
+CORBA::Boolean SALOMEDS_StudyManager_i::SaveAsASCII(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile)
 {
   SALOMEDS::Locker lock;
 
   if(aStudy->_is_nil()) {
     MESSAGE("SaveASCII error: Study is null");
-    return;
+    return false;
   }
 
   Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
-  _impl->SaveAsASCII(TCollection_AsciiString((char*)aUrl), aStudyImpl, _factory, theMultiFile);
+  return _impl->SaveAsASCII(TCollection_AsciiString((char*)aUrl), aStudyImpl, _factory, theMultiFile);
 }
 
 //============================================================================
index 139cb86d3cb7e327c5192986b0882155e236aca5..ef428ed4cef3803db4afe9f3b4de200115a2703d 100644 (file)
@@ -100,17 +100,17 @@ public:
   /*!
     \param Study_ptr arguments
   */
-  virtual void Save( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
+  virtual CORBA::Boolean Save( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
 
-  virtual void SaveASCII( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
+  virtual CORBA::Boolean SaveASCII( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
 
   //! method to save a Study to the persistent reference aUrl
   /*!
     \param char* arguments, the new URL of the study
     \param Study_ptr arguments
   */
-  virtual void SaveAs(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
-  virtual void SaveAsASCII(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
+  virtual CORBA::Boolean SaveAs(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
+  virtual CORBA::Boolean SaveAsASCII(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
 
  //! method to Get name list of open studies in the session
   /*!
index 3ac01ede89a5f501c3c7ed5930aaa98408e2de72..2c4cdc52cc7f35e78179acdad60f023de603f369 100644 (file)
 
 #include "SALOMEDS_UseCaseBuilder.hxx"
 
-#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDS.hxx"
 #include "SALOMEDS_SObject.hxx"
-#include "SALOMEDSImpl_UseCaseIterator.hxx"
 #include "SALOMEDS_UseCaseIterator.hxx"
+
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_UseCaseIterator.hxx"
+
 #include <TCollection_AsciiString.hxx> 
 #include <string>
 
@@ -57,7 +60,10 @@ bool SALOMEDS_UseCaseBuilder::Append(const _PTR(SObject)& theObject)
 {
   bool ret;
   SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
-  if(_isLocal) ret = _local_impl->Append(obj->GetLocalImpl());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = _local_impl->Append(obj->GetLocalImpl());
+  }
   else ret = _corba_impl->Append(obj->GetCORBAImpl());
   return ret;
 }
@@ -66,7 +72,10 @@ bool SALOMEDS_UseCaseBuilder::Remove(const _PTR(SObject)& theObject)
 {
   bool ret;
   SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
-  if(_isLocal) ret = _local_impl->Remove(obj->GetLocalImpl());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = _local_impl->Remove(obj->GetLocalImpl());
+  }
   else ret = _corba_impl->Remove(obj->GetCORBAImpl());
   return ret;
 }
@@ -76,7 +85,10 @@ bool SALOMEDS_UseCaseBuilder::AppendTo(const _PTR(SObject)& theFather, _PTR(SObj
   bool ret;
   SALOMEDS_SObject* father = dynamic_cast<SALOMEDS_SObject*>(theFather.get());
   SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
-  if(_isLocal) ret = _local_impl->AppendTo(father->GetLocalImpl(), obj->GetLocalImpl());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = _local_impl->AppendTo(father->GetLocalImpl(), obj->GetLocalImpl());
+  }
   else ret = _corba_impl->AppendTo(father->GetCORBAImpl(), obj->GetCORBAImpl());
   return ret;
 }
@@ -86,7 +98,10 @@ bool SALOMEDS_UseCaseBuilder::InsertBefore(const _PTR(SObject)& theFirst, _PTR(S
   bool ret;
   SALOMEDS_SObject* first = dynamic_cast<SALOMEDS_SObject*>(theFirst.get());
   SALOMEDS_SObject* next = dynamic_cast<SALOMEDS_SObject*>(theNext.get());
-  if(_isLocal) ret = _local_impl->InsertBefore(first->GetLocalImpl(), next->GetLocalImpl());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = _local_impl->InsertBefore(first->GetLocalImpl(), next->GetLocalImpl());
+  }
   else ret = _corba_impl->InsertBefore(first->GetCORBAImpl(), next->GetCORBAImpl());
   return ret;
 }
@@ -95,7 +110,10 @@ bool SALOMEDS_UseCaseBuilder::SetCurrentObject(const _PTR(SObject)& theObject)
 {
   bool ret;
   SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
-  if(_isLocal) ret = _local_impl->SetCurrentObject(obj->GetLocalImpl());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = _local_impl->SetCurrentObject(obj->GetLocalImpl());
+  }
   else ret = _corba_impl->SetCurrentObject(obj->GetCORBAImpl());
   return ret;
 }
@@ -103,7 +121,10 @@ bool SALOMEDS_UseCaseBuilder::SetCurrentObject(const _PTR(SObject)& theObject)
 bool SALOMEDS_UseCaseBuilder::SetRootCurrent()
 {
   bool ret;
-  if(_isLocal) ret = _local_impl->SetRootCurrent();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = _local_impl->SetRootCurrent();
+  }
   else ret = _corba_impl->SetRootCurrent();
   return ret;
 }
@@ -112,7 +133,10 @@ bool SALOMEDS_UseCaseBuilder::HasChildren(const _PTR(SObject)& theObject)
 {
   bool ret;
   SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
-  if(_isLocal) ret = _local_impl->HasChildren(obj->GetLocalImpl());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = _local_impl->HasChildren(obj->GetLocalImpl());
+  }
   else ret = _corba_impl->HasChildren(obj->GetCORBAImpl());
   return ret;
 }
@@ -121,7 +145,10 @@ bool SALOMEDS_UseCaseBuilder::IsUseCase(const _PTR(SObject)& theObject)
 {
   bool ret;
   SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
-  if(_isLocal) ret = _local_impl->IsUseCase(obj->GetLocalImpl());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = _local_impl->IsUseCase(obj->GetLocalImpl());
+  }
   else ret = _corba_impl->IsUseCase(obj->GetCORBAImpl());
   return ret;
 }
@@ -129,7 +156,10 @@ bool SALOMEDS_UseCaseBuilder::IsUseCase(const _PTR(SObject)& theObject)
 bool SALOMEDS_UseCaseBuilder::SetName(const std::string& theName)
 {
   bool ret;
-  if(_isLocal) ret = _local_impl->SetName((char*)theName.c_str());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = _local_impl->SetName((char*)theName.c_str());
+  }
   else ret = _corba_impl->SetName((char*)theName.c_str());
   return ret;
 }
@@ -137,7 +167,10 @@ bool SALOMEDS_UseCaseBuilder::SetName(const std::string& theName)
 _PTR(SObject) SALOMEDS_UseCaseBuilder::GetCurrentObject()
 {
   SALOMEDS_SObject* obj = NULL;
-  if(_isLocal) obj = new SALOMEDS_SObject(_local_impl->GetCurrentObject());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    obj = new SALOMEDS_SObject(_local_impl->GetCurrentObject());
+  }
   else obj = new SALOMEDS_SObject(_corba_impl->GetCurrentObject());
   return _PTR(SObject)(obj);
 }
@@ -145,7 +178,10 @@ _PTR(SObject) SALOMEDS_UseCaseBuilder::GetCurrentObject()
 std::string SALOMEDS_UseCaseBuilder::GetName()
 {
   std::string aName;
-  if(_isLocal) aName = _local_impl->GetName().ToCString();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aName = _local_impl->GetName().ToCString();
+  }
   else aName = _corba_impl->GetName();
   return aName;
 }
@@ -153,7 +189,10 @@ std::string SALOMEDS_UseCaseBuilder::GetName()
 _PTR(SObject) SALOMEDS_UseCaseBuilder::AddUseCase(const std::string& theName)
 {
   SALOMEDS_SObject* obj = NULL;
-  if(_isLocal) obj = new SALOMEDS_SObject(_local_impl->AddUseCase((char*)theName.c_str()));
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    obj = new SALOMEDS_SObject(_local_impl->AddUseCase((char*)theName.c_str()));
+  }
   else obj = new SALOMEDS_SObject(_corba_impl->AddUseCase((char*)theName.c_str()));
   return _PTR(SObject)(obj);
 }
@@ -162,7 +201,10 @@ _PTR(UseCaseIterator) SALOMEDS_UseCaseBuilder::GetUseCaseIterator(const _PTR(SOb
 {
   SALOMEDS_UseCaseIterator* it = NULL;
   SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
-  if(_isLocal) it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(obj->GetLocalImpl()));
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(obj->GetLocalImpl()));
+  }
   else it = new SALOMEDS_UseCaseIterator(_corba_impl->GetUseCaseIterator(obj->GetCORBAImpl()));
   return _PTR(UseCaseIterator)(it);
 }
index 71fc2d899c8cd36055759ec9bda95e08934b3516..006658d15995095204a60fc4304e25d0257f826a 100644 (file)
@@ -24,6 +24,8 @@
 
 
 #include "SALOMEDS_UseCaseIterator.hxx"
+
+#include "SALOMEDS.hxx"
 #include "SALOMEDS_SObject.hxx"
 
 using namespace std; 
@@ -49,28 +51,40 @@ SALOMEDS_UseCaseIterator::~SALOMEDS_UseCaseIterator()
 
 void SALOMEDS_UseCaseIterator::Init(bool theAllLevels)
 {
-  if(_isLocal) _local_impl->Init(theAllLevels);
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    _local_impl->Init(theAllLevels);
+  }
   else _corba_impl->Init(theAllLevels);
 }
 
 bool SALOMEDS_UseCaseIterator::More()
 {
   bool ret;
-  if(_isLocal) ret = _local_impl->More();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    ret = _local_impl->More();
+  }
   else ret = _corba_impl->More();
   return ret;
 }
 
 void SALOMEDS_UseCaseIterator::Next()
 {
-  if(_isLocal) _local_impl->Next();
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    _local_impl->Next();
+  }
   else _corba_impl->Next();
 }
 
 _PTR(SObject) SALOMEDS_UseCaseIterator::Value()
 {
   SALOMEDS_SObject* aSO;
-  if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->Value());
+  if (_isLocal) {
+    SALOMEDS::Locker lock;
+    aSO = new SALOMEDS_SObject(_local_impl->Value());
+  }
   else aSO = new SALOMEDS_SObject(_corba_impl->Value());
   return _PTR(SObject)(aSO);
 }
index 51e603cd8cb5a30de08dffc81b296553027cdd9b..1341fafcc9e481f7382d38a69ba2584e1f0b2ed4 100644 (file)
@@ -38,10 +38,10 @@ public:
   virtual _PTR(Study) NewStudy(const std::string& study_name) = 0;
   virtual _PTR(Study) Open(const std::string& theStudyUrl) = 0;
   virtual void Close(const _PTR(Study)& theStudy) = 0;
-  virtual void Save(const _PTR(Study)& theStudy, bool theMultiFile) = 0;
-  virtual void SaveASCII(const _PTR(Study)& theStudy, bool theMultiFile) = 0;
-  virtual void SaveAs(const std::string& theUrl,  const _PTR(Study)& theStudy, bool theMultiFile) = 0;
-  virtual void SaveAsASCII(const std::string& theUrl,  const _PTR(Study)& theStudy, bool theMultiFile) = 0;
+  virtual bool Save(const _PTR(Study)& theStudy, bool theMultiFile) = 0;
+  virtual bool SaveASCII(const _PTR(Study)& theStudy, bool theMultiFile) = 0;
+  virtual bool SaveAs(const std::string& theUrl,  const _PTR(Study)& theStudy, bool theMultiFile) = 0;
+  virtual bool SaveAsASCII(const std::string& theUrl,  const _PTR(Study)& theStudy, bool theMultiFile) = 0;
   virtual std::vector<std::string> GetOpenStudies() = 0;
   virtual _PTR(Study) GetStudyByName(const std::string& theStudyName) = 0;
   virtual _PTR(Study) GetStudyByID(int theStudyID) = 0;
index b181b0fb2d25e73a8c545a526f4d3fa0270a5734..b3452db044d2ac1b670a243bff2e516fe9532312 100644 (file)
@@ -1265,14 +1265,18 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath,
     Handle(SALOMEDSImpl_SComponent) sco = itcomponent.Value();
     aCompType = sco->ComponentDataType();
     //GEOM and MED are independent components
-    if(aCompType == "GEOM" || aCompType == "MED") aSeq.Prepend(TCollection_ExtendedString(aCompType));
-    else aSeq.Append(TCollection_ExtendedString(aCompType));
+    if (aCompType == "GEOM" || aCompType == "MED")
+      aSeq.Prepend(TCollection_ExtendedString(aCompType));
+    else
+      aSeq.Append(TCollection_ExtendedString(aCompType));
   }
 
 #ifdef WIN32
-  TCollection_AsciiString aFileName=thePath+TCollection_AsciiString("\\")+theBaseName+TCollection_AsciiString(".py");
+  TCollection_AsciiString aFileName =
+    thePath + TCollection_AsciiString("\\") + theBaseName + TCollection_AsciiString(".py");
 #else
-  TCollection_AsciiString aFileName=thePath+TCollection_AsciiString("/")+theBaseName+TCollection_AsciiString(".py");
+  TCollection_AsciiString aFileName =
+    thePath + TCollection_AsciiString("/")  + theBaseName + TCollection_AsciiString(".py");
 #endif
 
   //Create a file that will contain a main Study script
@@ -1292,7 +1296,8 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath,
 
   TCollection_AsciiString aBatchModeScript = "salome";
 
-  //Output to the main Study script required Python modules import, set sys.path and add a creation of the study.
+  //Output to the main Study script required Python modules import,
+  //set sys.path and add a creation of the study.
   fp << GetDumpStudyComment().ToCString() << endl << endl;
   fp << "import sys" << endl;
   fp << "import " << aBatchModeScript << "\n" << endl;
@@ -1362,9 +1367,9 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath,
     fp2.open(aFileName.ToCString(), ios::out);
 
 #ifdef WIN32
-    isOpened = fp.is_open();
+    isOpened = fp2.is_open();
 #else
-    isOpened = fp.rdbuf()->is_open();
+    isOpened = fp2.rdbuf()->is_open();
 #endif
 
     if(!isOpened) {
@@ -1377,6 +1382,8 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath,
     fp2 << aStream;
     fp2.close();
 
+    if (aStream != NULL) delete [] aStream;
+
     //Add to the main script a call to RebuildData of the generated by the component the Python script
     fp << "import " << aScriptName << endl;
     fp << aScriptName << ".RebuildData(" << aBatchModeScript << ".myStudy)" << endl;
index 4dcefc7c6210cef3bc3be65d587a35ce4a3f2d79..d527211d7549c39b74c04550ff0ae4fe2cd6d2f2 100644 (file)
@@ -280,7 +280,8 @@ bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const Handle(SALOMEDSIm
  *  Purpose  : 
  */
 //============================================================================
-bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& anSCO, SALOMEDSImpl_Driver* aDriver) 
+bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& anSCO,
+                                         SALOMEDSImpl_Driver* aDriver) 
 {
   _errorCode = "";
 
@@ -291,7 +292,7 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)&
   if (_doc->Main().FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(),Att)) {
     int aLocked = anSCO->GetStudy()->GetProperties()->IsLocked();
     if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(false);
-    
+
     TCollection_ExtendedString Res(Att->Value());
 
     Handle(SALOMEDSImpl_AttributeComment) type;
@@ -313,24 +314,22 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)&
     }
 
     DefineComponentInstance (anSCO, aDriver->GetIOR());
-    
+
     TCollection_AsciiString aHDFPath(Res);
-    
-    char* aHDFUrl;
+
+    TCollection_AsciiString aHDFUrl;
     bool isASCII = false;
     if (HDFascii::isASCII(aHDFPath.ToCString())) {
       isASCII = true;
-      char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aHDFPath.ToCString());
-      aHDFUrl = new char[strlen(aResultPath) + 19];
-      sprintf(aHDFUrl, "%shdf_from_ascii.hdf", aResultPath);
-      delete(aResultPath);
+      aHDFUrl = HDFascii::ConvertFromASCIIToHDF(aHDFPath.ToCString());
+      aHDFUrl += "hdf_from_ascii.hdf";
     } else {
-      aHDFUrl = aHDFPath.ToCString();
+      aHDFUrl = aHDFPath;
     }
 
     //Open the Study HDF file 
-    HDFfile *hdf_file = new HDFfile(aHDFUrl); 
-    
+    HDFfile *hdf_file = new HDFfile(aHDFUrl.ToCString()); 
+
     char aMultifileState[2];
     char ASCIIfileState[2];
     try {
@@ -340,7 +339,7 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)&
       hdf_group->OpenOnDisk();
       HDFgroup *hdf_sco_group = new HDFgroup(scoid.ToCString(), hdf_group);
       hdf_sco_group->OpenOnDisk();
-       
+
       unsigned char* aStreamFile = NULL;
       int aStreamSize = 0;
 
@@ -353,16 +352,17 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)&
        hdf_dataset->ReadFromDisk(aStreamFile);
        hdf_dataset->CloseOnDisk();
        hdf_dataset = 0;
-      } else aStreamFile = NULL;
-     
+      } else
+        aStreamFile = NULL;
+
       HDFdataset *multifile_hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group);
       multifile_hdf_dataset->OpenOnDisk();
       multifile_hdf_dataset->ReadFromDisk(aMultifileState);
-      
+
       HDFdataset *ascii_hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group);
       ascii_hdf_dataset->OpenOnDisk();
       ascii_hdf_dataset->ReadFromDisk(ASCIIfileState);
-      
+
       // set path without file name from URL 
       int aFileNameSize = Res.Length();
       char* aDir = new char[aFileNameSize];
@@ -372,7 +372,7 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)&
          aDir[aCounter+1] = 0;
          break;
        }
-      
+
       bool aResult = (ASCIIfileState[0]=='A')?
        aDriver->LoadASCII(anSCO, aStreamFile, aStreamSize, aDir, aMultifileState[0]=='M'):
        aDriver->Load(anSCO, aStreamFile, aStreamSize, aDir, aMultifileState[0]=='M');
@@ -385,14 +385,14 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)&
        _errorCode = "Can't load component";
        throw HDFexception("Unable to load component");
       }
-   
+
       if(aDir != NULL) delete []aDir;
 
       multifile_hdf_dataset->CloseOnDisk();
       multifile_hdf_dataset = 0;
       ascii_hdf_dataset->CloseOnDisk();
       ascii_hdf_dataset = 0;
-   
+
       hdf_sco_group->CloseOnDisk();
       hdf_sco_group = 0;
       hdf_group->CloseOnDisk();
@@ -403,10 +403,9 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)&
       if (isASCII) {
        Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString;
        aFilesToRemove->Append(aHDFUrl);
-       SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
+       SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl),
+                                                aFilesToRemove, true);
       }      
-
-      delete aHDFUrl;
     }
     catch (HDFexception) {
       delete hdf_file;
@@ -416,7 +415,6 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)&
        aFilesToRemove->Append(aHDFUrl);
        SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
       }
-      delete aHDFUrl;
 
       if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true);
       _errorCode = "No persistent file";