]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
- Adding ParallelSalome_file
authorribes <ribes>
Fri, 14 Sep 2007 13:05:33 +0000 (13:05 +0000)
committerribes <ribes>
Fri, 14 Sep 2007 13:05:33 +0000 (13:05 +0000)
- BASIC_short ok

idl/Makefile.am
idl/SALOME_Component.idl
idl/SALOME_Component.xml
src/DSC/DSC_User/Basic/data_short_port_provides.cxx
src/DSC/DSC_User/Basic/data_short_port_provides.hxx

index 21300235c3096f1a40861470c6f6bdf5642cd5b0..bd67a2866a3946070b3c65b7eb564ea2a7acb470 100644 (file)
@@ -132,6 +132,12 @@ GEN_PACO = SALOME_ComponentPaCO_Engines_Container_server.cc \
           SALOME_ComponentPaCO_Engines_Container_client.cc \
           SALOME_ComponentPaCO_Engines_Component_server.cc \
           SALOME_ComponentPaCO_Engines_Component_client.cc \
+          SALOME_ComponentPaCO_Engines_fileTransfer_server.cc \
+          SALOME_ComponentPaCO_Engines_fileTransfer_client.cc \
+          SALOME_ComponentPaCO_Engines_Salome_file_server.cc \
+          SALOME_ComponentPaCO_Engines_Salome_file_client.cc \
+          SALOME_ComponentPaCO_Engines_Parallel_Salome_file_server.cc \
+          SALOME_ComponentPaCO_Engines_Parallel_Salome_file_client.cc \
           SALOME_PortsPaCO_Ports_Port_server.cc \
           SALOME_PortsPaCO_Ports_Port_client.cc \
           DSC_EnginesPaCO_Engines_DSC_server.cc \
@@ -145,6 +151,12 @@ INCLUDES_PACO = SALOME_ComponentPaCO_Engines_Container_server.h \
                SALOME_ComponentPaCO_Engines_Container_client.h \
                 SALOME_ComponentPaCO_Engines_Component_server.h \
                SALOME_ComponentPaCO_Engines_Component_client.h \
+               SALOME_ComponentPaCO_Engines_fileTransfer_server.h \
+               SALOME_ComponentPaCO_Engines_fileTransfer_client.h \
+               SALOME_ComponentPaCO_Engines_Salome_file_server.h \
+               SALOME_ComponentPaCO_Engines_Salome_file_client.h \
+               SALOME_ComponentPaCO_Engines_Parallel_Salome_file_server.h \
+               SALOME_ComponentPaCO_Engines_Parallel_Salome_file_client.h \
                SALOME_ExceptionPaCO.h \
                SALOME_ComponentPaCO.h \
                SALOME_Exception.h \
index 9a0d61fe946fa3497c4cd1c92429219d99f99a41..9cfef58412f446fe5fc709ffa476b413a46726bf 100644 (file)
@@ -631,6 +631,40 @@ module Engines
     string getRef(in string machine);
   };
 
+  /*! \brief Interface of a Parallel_Salome_file
+    This interface is used by parallel components and containers.
+    It adds methods to enable to choose on which node of the parallel component the file has to 
+    be received.
+  */
+  interface Parallel_Salome_file : Engines::Salome_file {
+
+    /*!
+      Add a Local file to the Salome_file.
+
+      \param file_name name of the file with the path.
+      \param node the number of the node where the file is.
+
+      \exception raised if the file is already added into the Salome_file.
+    */
+    void setParallelLocalFile(in string comp_file_name, in long node) raises (SALOME::SALOME_Exception);
+
+    /*!
+      Add a Distributed file to the Salome_file.
+
+      \param comp_file_name name of the file with the path.
+
+      \exception raised if the file is already added into the Salome_file.
+    */
+    void setParallelDistributedFile(in string comp_file_name, in long node) raises (SALOME::SALOME_Exception);
+
+    /*!
+      This method update the state of the Parallel_Salome_file. Thus, each node
+      of the Parallel_Salome_file has the same state.
+
+      \param new_state the new state of the Parallel_Salome_file.
+     */
+    void updateState(in Engines::SfState new_state);
+  };
 } ;
 
 #endif
index 22b783fc23fa9b3683f66c5c76881ba70243a173..a37b740f7319b756310cb701cca84b27a0731360 100644 (file)
    <Type>distributed</Type>
   </Method>
  </Interface>
+ <Interface>
+  <Name>Parallel_Salome_file</Name>
+  <Method>
+   <Name>setParallelLocalFile</Name>
+   <Type>distributed</Type>
+  </Method>
+  <Method>
+   <Name>setParallelDistributedFile</Name>
+   <Type>distributed</Type>
+  </Method>
+ </Interface>
 </Module>
 </GridCCM_Interface_description>
index fa289f3f5d3f7ce20e0cfbcd40b087598d8acc1e..5b204d41fc6fbc20281ceaccaf2ef46aa0b6e661 100644 (file)
@@ -32,6 +32,11 @@ data_short_port_provides::data_short_port_provides() {
   pthread_mutex_init(short_mutex, NULL);
   short_condition = new pthread_cond_t();
   pthread_cond_init(short_condition, NULL);
+  short_termine_cp = true;                 
+  short_mutex_cp = new pthread_mutex_t();
+  pthread_mutex_init(short_mutex_cp, NULL);
+  short_condition_cp = new pthread_cond_t();
+  pthread_cond_init(short_condition_cp, NULL);
 }
 
 data_short_port_provides::~data_short_port_provides() {
@@ -39,10 +44,23 @@ data_short_port_provides::~data_short_port_provides() {
   delete short_mutex;
   pthread_cond_destroy(short_condition);
   delete short_condition;
+  pthread_mutex_destroy(short_mutex_cp);
+  delete short_mutex_cp;
+  pthread_cond_destroy(short_condition_cp);
+  delete short_condition_cp;
 }
 
 void
 data_short_port_provides::put(CORBA::Short data) {
+  // On attend que le get soit fait
+  pthread_mutex_lock(short_mutex_cp);
+  while (short_termine_cp == false)
+  {
+     pthread_cond_wait(short_condition_cp, short_mutex_cp);
+  }
+  short_termine_cp = false;
+  pthread_mutex_unlock(short_mutex_cp);
+
   pthread_mutex_lock(short_mutex);
   _val = data;
   short_termine = true;
@@ -52,14 +70,22 @@ data_short_port_provides::put(CORBA::Short data) {
 
 CORBA::Short
 data_short_port_provides::get() {
+  CORBA::Short result;
   pthread_mutex_lock(short_mutex);
   while (short_termine == false)
   {
      pthread_cond_wait(short_condition, short_mutex);
   }
+  result = _val;
   short_termine = false;
   pthread_mutex_unlock(short_mutex);
-  return _val;
+
+  // On indique que l'on a copie la valeur
+  pthread_mutex_lock(short_mutex_cp);
+  short_termine_cp = true;
+  pthread_cond_signal(short_condition_cp);
+  pthread_mutex_unlock(short_mutex_cp);
+  return result;
 }
 
 Ports::Port_ptr
index cdc38d5b0cbf872620839f53b9f5a224a6173a28..df33f65510784f58195a7bc96e56e825dacf9812 100644 (file)
@@ -69,6 +69,9 @@ class data_short_port_provides :
     pthread_mutex_t * short_mutex;
     pthread_cond_t * short_condition;
     bool short_termine;
+    pthread_mutex_t * short_mutex_cp;
+    pthread_cond_t * short_condition_cp;
+    bool short_termine_cp;
 
 };