]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
CCAR: various optimisations and synchronize with V5_1_main branch
authorcaremoli <caremoli>
Wed, 7 Jul 2010 14:34:15 +0000 (14:34 +0000)
committercaremoli <caremoli>
Wed, 7 Jul 2010 14:34:15 +0000 (14:34 +0000)
13 files changed:
bin/launchConfigureParser.py
bin/runSalome.py
idl/SALOMEDS.idl
salome_adm/cmake_files/am2cmake.py
src/KERNEL_PY/import_hook.py
src/SALOMEDS/SALOMEDS_Study.cxx
src/SALOMEDS/SALOMEDS_Study.hxx
src/SALOMEDS/SALOMEDS_Study_i.cxx
src/SALOMEDS/SALOMEDS_Study_i.hxx
src/SALOMEDSClient/SALOMEDSClient_Study.hxx
src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx
src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx

index 7fde55b7987e62405bc5e53ba2e90fc8a0c68432..b807edad5bd7b83177e79d667b6d9c1ca4779b00 100755 (executable)
@@ -59,6 +59,7 @@ test_nam       = "test"
 play_nam       = "play"
 gdb_session_nam = "gdb_session"
 ddd_session_nam = "ddd_session"
+valgrind_session_nam = "valgrind_session"
 shutdown_servers_nam = "shutdown_servers"
 
 # values in XML configuration file giving specific module parameters (<module_name> section)
@@ -638,6 +639,14 @@ def CreateOptionParser (theAdditionalOptions=[]):
                             dest="ddd_session", default=False,
                             help=help_str)
     
+
+    # valgrind session
+    help_str = "Launch session with valgrind $VALGRIND_OPTIONS"
+    o_valgrind = optparse.Option("--valgrind-session",
+                                 action="store_true",
+                                 dest="valgrind_session", default=False,
+                                 help=help_str)
+
     # shutdown-servers. Default: False.
     help_str  = "1 to shutdown standalone servers when leaving python interpreter, "
     help_str += "0 to keep the standalone servers as daemon [default]. "
@@ -675,6 +684,7 @@ def CreateOptionParser (theAdditionalOptions=[]):
                 o_play,  # Reproducing test script with help of TestRecorder
                 o_gdb,
                 o_ddd,
+                o_valgrind,
                 o_shutdown,
                 ]
 
@@ -969,6 +979,10 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"):
     if cmd_opts.ddd_session is not None:
         args[ddd_session_nam] = cmd_opts.ddd_session
 
+    # valgrind session
+    if cmd_opts.valgrind_session is not None:
+        args[valgrind_session_nam] = cmd_opts.valgrind_session
+
     # Shutdown servers
     if cmd_opts.shutdown_servers is None:
         args[shutdown_servers_nam] = 0
index d03a67d6e4e5d55b5e07603e25d6d5f6757a3783..f0bed272df32f28adae255cb20f2878eb84c4e31 100755 (executable)
@@ -323,6 +323,15 @@ class SessionServer(Server):
                 pass
             pass
         
+        if self.args["valgrind_session"]:
+            l = ["valgrind"]
+            val = os.getenv("VALGRIND_OPTIONS")
+            if val:
+                l += val.split()
+                pass
+            self.CMD = l + self.CMD
+            pass
+        
 # ---
 
 class LauncherServer(Server):
index ace331d1ab344ab9056637d954073fa501db3361..0699b89855ae00fa48294ca6f699fd6e107f8f03 100644 (file)
@@ -553,7 +553,7 @@ during each working session.
 
     \param theObserver
 */
-     void attach(in SALOME::Observer theObserver);   
+     void attach(in SALOME::Observer theObserver, in boolean modify);   
   };
 
   //==========================================================================
index 19ced5ac6c7ee68363717687803605b8efaf509c..b2c757193580993bc91629d56b3e58a153d7b772 100644 (file)
@@ -750,6 +750,23 @@ class CMakeFile(object):
                 ENDIF(KERNEL_ROOT_DIR)
                 ''')
                 pass
+            if self.module == "hxx2salome":
+                key = "_SRC"
+                if self.the_root[-len(key):] != key:
+                    msg = "Source dir must finished with %s !"%(key)
+                    raise Exception(msg)
+                hxxmodule = self.the_root[:-len(key)]
+                from os.path import basename
+                hxxmodule = basename(hxxmodule)
+                hxxmodule = hxxmodule.lower()
+                self.hxxmodule = hxxmodule
+                newlines.append(r'''
+                SET(HXXCPP_ROOT_DIR $ENV{%sCPP_ROOT_DIR})
+                SET(AM_CPPFLAGS ${AM_CPPFLAGS} -I${HXXCPP_ROOT_DIR}/include)
+                SET(AM_CXXFLAGS ${AM_CXXFLAGS} -I${HXXCPP_ROOT_DIR}/include)
+                SET(LDADD ${LDADD} -L${HXXCPP_ROOT_DIR}/lib)
+                '''%(hxxmodule.upper()))
+                pass
             pass
         # --
         return
@@ -1242,6 +1259,10 @@ class CMakeFile(object):
         # --
         # Treat the install targets
         # --
+        resdir = self.module
+        if resdir == "hxx2salome":
+            resdir = self.hxxmodule
+            pass
         d = {
             "salomeadmux_DATA"            :  "salome_adm/unix",
             "dist_salomeadmux_DATA"       :  "salome_adm/unix",
@@ -1252,9 +1273,9 @@ class CMakeFile(object):
             "dist_admlocal_cmake_DATA"    :  "adm_local/cmake_files",
             "salomeinclude_DATA"          :  "include/salome",
             "salomeinclude_HEADERS"       :  "include/salome",
-            "dist_salomeres_DATA"         :  "share/salome/resources/%s"%(self.module),
-            "nodist_salomeres_DATA"       :  "share/salome/resources/%s"%(self.module),
-            "nodist_salomeres_SCRIPTS"    :  "share/salome/resources/%s"%(self.module),
+            "dist_salomeres_DATA"         :  "share/salome/resources/%s"%(resdir),
+            "nodist_salomeres_DATA"       :  "share/salome/resources/%s"%(resdir),
+            "nodist_salomeres_SCRIPTS"    :  "share/salome/resources/%s"%(resdir),
             "dist_salomescript_SCRIPTS"   :  "bin/salome",
             "dist_salomescript_DATA"      :  "bin/salome",
             "dist_salomescript_PYTHON"    :  "bin/salome",
@@ -1311,18 +1332,13 @@ class CMakeFile(object):
         ''')
         # --
         newlines.append(r'''
-        SET(libs ${PLATFORM_LIBADD} ${PLATFORM_LDFLAGS} ${${amname}_LIBADD} ${${amname}_LDADD} ${${amname}_LDFLAGS})
+        SET(libs ${PLATFORM_LIBADD} ${PLATFORM_LDFLAGS} ${LDADD} ${${amname}_LIBADD} ${${amname}_LDADD} ${${amname}_LDFLAGS})
         FOREACH(lib SALOMEBasics SalomeBatch)
         IF(name STREQUAL lib)
         SET(libs ${libs} ${PTHREAD_LIBS})
         ENDIF(name STREQUAL lib)
         ENDFOREACH(lib SALOMEBasics SalomeBatch)
         ''')
-        if key == "bin_PROGRAMS":
-            newlines.append(r'''
-            SET(libs ${libs} ${LDADD})
-            ''')
-            pass
         # --
         newlines.append(r'''
         FOREACH(lib ${libs})
@@ -1933,6 +1949,8 @@ if __name__ == "__main__":
     from os import getcwd
     the_root = getcwd()
     #
+    nok = 0
+    #
     from os import walk
     for root, dirs, files in walk(the_root):
         # --
@@ -1954,12 +1972,20 @@ if __name__ == "__main__":
         from sys import stdout
         for f in files:
             if f in ["Makefile.am", "Makefile.am.cmake"]:
-                stdout.write("Scanning %s %s ..."%(root, f))
-                stdout.flush()
                 convertAmFile(the_root, root, dirs, files, f, module)
-                stdout.write(" done.\n")
+                nok += 1
                 pass
             pass
         pass
     #
+    if nok:
+        if nok == 1:
+            msg = "%s file has been converted to cmake"%(nok)
+        else:
+            msg = "%s files have been converted to cmake"%(nok)
+            pass
+        stdout.write(msg)
+        stdout.write("\n")
+        stdout.flush()
+        pass
     pass
index 54c5f1313dec1ee9939d928c8e5eadbf1a35359a..3d628ecab835b9500c677df6e197442c154e1bf1 100755 (executable)
@@ -151,14 +151,14 @@ def ensure_fromlist(m, fromlist, recursive=0):
             l.append((subname,submod))
     return l
 
-def import_hook(name, globals=None, locals=None, fromlist=None, *args):
+def import_hook(name, globals=None, locals=None, fromlist=None, *args, **kwds):
     """ Import replacement for sharing modules among multiple interpreters
         Mostly update sys.modules before doing real import
     """
     #print "import_hook",name,fromlist
     m=get_shared_imported(name,fromlist)
 
-    module= original_import(name, globals, locals, fromlist, *args)
+    module= original_import(name, globals, locals, fromlist, *args, **kwds)
 
     if fromlist:
        #when fromlist is specified, module is the real module
index 43c7932a1f475eeb25839e11da0dc7c788b47096..da6093f87699c7c161a46b8b8cce4dae73cd3100 100644 (file)
@@ -1000,9 +1000,9 @@ _PTR(AttributeParameter) SALOMEDS_Study::GetModuleParameters(const std::string&
   return _PTR(AttributeParameter)(AP);
 }
 
-void SALOMEDS_Study::attach(SALOME::Observer_ptr theObserver)
+void SALOMEDS_Study::attach(SALOME::Observer_ptr theObserver,bool modify)
 {
   if(CORBA::is_nil(_corba_impl)) GetStudy(); //If CORBA implementation is null then retrieve it
-  _corba_impl->attach(theObserver);
+  _corba_impl->attach(theObserver,modify);
 }
 
index 4f17c4d86251d24949b784e767a869ec45c328a4..1f5eae6b60b5b82ddc694a664b8769930209aa75 100644 (file)
@@ -122,7 +122,7 @@ public:
   virtual bool RenameVariable(const std::string& theVarName, const std::string& theNewVarName);
   virtual bool IsVariableUsed(const std::string& theVarName);
   virtual std::vector< std::vector<std::string> > ParseVariables(const std::string& theVars);
-  virtual void attach(SALOME::Observer_ptr theObserver);
+  virtual void attach(SALOME::Observer_ptr theObserver,bool modify);
 
   std::string ConvertObjectToIOR(CORBA::Object_ptr theObject);
   CORBA::Object_ptr ConvertIORToObject(const std::string& theIOR);     
index 0bb71eb4f9152f3ef69fb9d04e5dfcc41a07e349..ed9a6b14aa1248013aed671f3fdc8152b4f6c8cb 100644 (file)
@@ -67,12 +67,11 @@ public:
 
   virtual bool addSO_Notification(const SALOMEDSImpl_SObject& theSObject)
     {
-      //MESSAGE("Notification ADD called")
-      CORBA::String_var event="ADD";
-      CORBA::String_var anID=theSObject.GetID().c_str();
+      std::string anID=theSObject.GetID();
+      const char* cID=anID.c_str();
       for (ObsListIter it (myObservers.begin()); it != myObservers.end(); ++it)
         {
-          (*it)->notifyObserver(anID,event);
+          it->first->notifyObserver(cID,"ADD");
         }
       return true; // NGE return always true but can be modified if needed
     }
@@ -85,12 +84,11 @@ public:
 
   virtual bool removeSO_Notification(const SALOMEDSImpl_SObject& theSObject)
     {
-      //MESSAGE("Notification REMOVE called")
-      CORBA::String_var event="REMOVE";
-      CORBA::String_var anID=theSObject.GetID().c_str();
+      std::string anID=theSObject.GetID();
+      const char* cID=anID.c_str();
       for (ObsListIter it (myObservers.begin()); it != myObservers.end(); ++it)
         {
-          (*it)->notifyObserver(anID,event);
+          it->first->notifyObserver(cID,"REMOVE");
         }
       return true; // NGE return always true but can be modified if needed
     }
@@ -103,12 +101,14 @@ public:
 
   virtual bool modifySO_Notification(const SALOMEDSImpl_SObject& theSObject)
     {
-      //MESSAGE("Notification MODIFY called")
-      CORBA::String_var event="MODIFY";
-      CORBA::String_var anID=theSObject.GetID().c_str();
       for (ObsListIter it (myObservers.begin()); it != myObservers.end(); ++it)
         {
-          (*it)->notifyObserver(anID,event);
+          if(it->second)
+            {
+              std::string anID=theSObject.GetID();
+              const char* cID=anID.c_str();
+              it->first->notifyObserver(cID,"MODIFY");
+            }
         }
       return true; // NGE return always true but can be modified if needed
     }
@@ -119,13 +119,13 @@ public:
  */
 //============================================================================
 
-  virtual void attach(SALOME::Observer_ptr theObs)
+  virtual void attach(SALOME::Observer_ptr theObs, bool modify)
     {
-      myObservers.push_back(SALOME::Observer::_duplicate(theObs));
+      myObservers.push_back(std::pair< SALOME::Observer_var, bool > (SALOME::Observer::_duplicate(theObs),modify));
     }
 
 private:
-    typedef std::list<SALOME::Observer_var> ObsList;
+    typedef std::list< std::pair< SALOME::Observer_var, bool > > ObsList;
     typedef ObsList::iterator ObsListIter;
     ObsList myObservers;
 };
@@ -1232,9 +1232,9 @@ void SALOMEDS_Study_i::EnableUseCaseAutoFilling(CORBA::Boolean isEnabled)
  *  Purpose  : This function attach an observer to the study
  */
 //============================================================================
-void SALOMEDS_Study_i::attach(SALOME::Observer_ptr theObs)
+void SALOMEDS_Study_i::attach(SALOME::Observer_ptr theObs,CORBA::Boolean modify)
 {
-  _notifier->attach(theObs);
+  _notifier->attach(theObs,modify);
 }
 
 //===========================================================================
index b2df91f8725fae9ae4768d59345a228a4bf58b41..9e3651ccd5142e8ecd0a4bf271f38a6d72ed94de 100644 (file)
@@ -349,7 +349,7 @@ public:
 
   virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
 
-  virtual void attach(SALOME::Observer_ptr theObs);
+  virtual void attach(SALOME::Observer_ptr theObs, CORBA::Boolean modify);
 
 };
 #endif
index 920104048a0a9a2c23981917e500f81a1aaf97f9..53f906994203ca7fe593e1da546f4f15c3bce0af 100644 (file)
@@ -123,7 +123,7 @@ public:
 
   virtual std::vector< std::vector<std::string> > ParseVariables(const std::string& theVars) = 0;
 
-  virtual void attach(SALOME::Observer_ptr theObserver) = 0;
+  virtual void attach(SALOME::Observer_ptr theObserver,bool modify) = 0;
 
 };
 
index afa1b1c5ce969350c0091db4546e41e211cbea16..7f3544df177709df37fa0454c62008c7296e9ded 100644 (file)
@@ -85,7 +85,7 @@ void SALOMEDSImpl_GenericAttribute::SetModifyFlag()
    if(aLabel.IsNull()) return; 
 
   SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
-  //if(aStudy) aStudy->modifySO_Notification(GetSObject());
+  if(aStudy) aStudy->modifySO_Notification(GetSObject());
   if(aStudy) aStudy->Modify();
 }
 
index 3c10982e220b05422d6c9be49b26abe8ead38312..c4acb241e7c2a1f7ffdb5e1e0646d7f6cd9b9d28 100644 (file)
@@ -2000,9 +2000,9 @@ std::vector<std::string> SALOMEDSImpl_Study::GetIORs()
 //============================================================================
 bool SALOMEDSImpl_Study::addSO_Notification (const SALOMEDSImpl_SObject& theSObject)
 {
-  START_TIMING;
+  //START_TIMING;
   bool ret= _notifier->addSO_Notification(theSObject);
-  END_TIMING(100);
+  //END_TIMING(100);
   return ret;
 }
 
index 3139b2fa0811e343737870ffa914b5676d1ae9e1..b62004ecb0e000e5e2524db8581da08f9867c395 100644 (file)
@@ -87,13 +87,13 @@ SALOMEDSImpl_SComponent SALOMEDSImpl_StudyBuilder::NewComponent(const std::strin
 
   DF_Label NL = L.NewChild();
 
-  SALOMEDSImpl_AttributeComment::Set(NL, DataType);
-
   SALOMEDSImpl_SComponent so =  _study->GetSComponent (NL);
 
   if(_callbackOnAdd) _callbackOnAdd->OnAddSObject(so);
   _study->addSO_Notification(so);
 
+  SALOMEDSImpl_AttributeComment::Set(NL, DataType);
+
   _doc->SetModified(true);
 
   return so;