From: ribes Date: Fri, 14 Sep 2007 13:05:33 +0000 (+0000) Subject: - Adding ParallelSalome_file X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=23b6aa3621fb21636b8625f715a28b7591df289b;p=modules%2Fkernel.git - Adding ParallelSalome_file - BASIC_short ok --- diff --git a/idl/Makefile.am b/idl/Makefile.am index 21300235c..bd67a2866 100644 --- a/idl/Makefile.am +++ b/idl/Makefile.am @@ -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 \ diff --git a/idl/SALOME_Component.idl b/idl/SALOME_Component.idl index 9a0d61fe9..9cfef5841 100644 --- a/idl/SALOME_Component.idl +++ b/idl/SALOME_Component.idl @@ -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 diff --git a/idl/SALOME_Component.xml b/idl/SALOME_Component.xml index 22b783fc2..a37b740f7 100644 --- a/idl/SALOME_Component.xml +++ b/idl/SALOME_Component.xml @@ -51,5 +51,16 @@ distributed + + Parallel_Salome_file + + setParallelLocalFile + distributed + + + setParallelDistributedFile + distributed + + diff --git a/src/DSC/DSC_User/Basic/data_short_port_provides.cxx b/src/DSC/DSC_User/Basic/data_short_port_provides.cxx index fa289f3f5..5b204d41f 100644 --- a/src/DSC/DSC_User/Basic/data_short_port_provides.cxx +++ b/src/DSC/DSC_User/Basic/data_short_port_provides.cxx @@ -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 diff --git a/src/DSC/DSC_User/Basic/data_short_port_provides.hxx b/src/DSC/DSC_User/Basic/data_short_port_provides.hxx index cdc38d5b0..df33f6551 100644 --- a/src/DSC/DSC_User/Basic/data_short_port_provides.hxx +++ b/src/DSC/DSC_User/Basic/data_short_port_provides.hxx @@ -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; };