SALOME documentation central

src/DSC/ParallelDSC/Param_Double_Port_provides_i.hxx

00001 //  Copyright (C) 2009  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 //  This library is free software; you can redistribute it and/or
00004 //  modify it under the terms of the GNU Lesser General Public
00005 //  License as published by the Free Software Foundation; either
00006 //  version 2.1 of the License.
00007 //
00008 //  This library is distributed in the hope that it will be useful,
00009 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 //  Lesser General Public License for more details.
00012 //
00013 //  You should have received a copy of the GNU Lesser General Public
00014 //  License along with this library; if not, write to the Free Software
00015 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 //  File   : param_double_port_provides.hxx
00020 //  Author : André RIBES (EDF)
00021 //  Module : KERNEL
00022 
00023 #ifndef _PARAM_DOUBLE_PORT_PROVIDES_HXX_
00024 #define _PARAM_DOUBLE_PORT_PROVIDES_HXX_
00025 
00026 #include "SALOME_ParamPortsPaCO_Ports_Param_Double_Port_server.hxx"
00027 
00028 #include "ParallelDSC_i.hxx"
00029 #include "PortProperties_i.hxx"
00030 
00031 class Param_Double_Port_provides_i :
00032   public virtual Ports::Param_Double_Port_serv
00033 {
00034   public :
00035     Param_Double_Port_provides_i(CORBA::ORB_ptr orb, char * ior, int rank);
00036     virtual ~Param_Double_Port_provides_i();
00037 
00038     void put(const Ports::Param_Double_Port::seq_double & param_data);
00039     void get_results(Ports::Param_Double_Port::seq_double_out param_results);
00040 
00041     // local methods
00042     Ports::Param_Double_Port::seq_double * get_data();
00043     void set_data(Ports::Param_Double_Port::seq_double * results);
00044     void configure_set_data(int data_length, 
00045                    int totalNbElt, 
00046                    int BeginEltPos);
00047 
00048     // Aide à la création du port
00049     static Param_Double_Port_provides_i * init_port(Engines_ParallelDSC_i * par_compo, 
00050                                   std::string port_name,
00051                                   CORBA::ORB_ptr orb);
00052 
00053     // Méthode temporaire en attendant d'avoir des méthodes parallèles bien synchronisé
00054     static void wait_init_port(Engines_ParallelDSC_i * par_compo, 
00055                       std::string port_name,
00056                       CORBA::ORB_ptr orb);
00057   private:
00058     // Buffers pour la réception et l'envoi
00059     Ports::Param_Double_Port::seq_double * _seq_data;
00060     Ports::Param_Double_Port::seq_double * _seq_results;
00061 
00062     // Variable pour la gestion du buffer de réception
00063     pthread_mutex_t * seq_data_mutex;
00064     pthread_cond_t * seq_data_condition;
00065     bool seq_data_termine;
00066     pthread_mutex_t * seq_data_mutex_cp;
00067     pthread_cond_t * seq_data_condition_cp;
00068     bool seq_data_termine_cp;
00069 
00070     // Variable pour la gestion du buffer d'envoi
00071     pthread_mutex_t * seq_results_mutex;
00072     pthread_cond_t * seq_results_condition;
00073     bool seq_results_termine;
00074     pthread_mutex_t * seq_results_mutex_cp;
00075     pthread_cond_t * seq_results_condition_cp;
00076     bool seq_results_termine_cp;
00077 };
00078 #endif