Salome HOME
Updated copyright comment
[modules/kernel.git] / src / DSC / ParallelDSC / Param_Double_Port_provides_i.hxx
1 // Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 //  File   : param_double_port_provides.hxx
21 //  Author : André RIBES (EDF)
22 //  Module : KERNEL
23 //
24 #ifndef _PARAM_DOUBLE_PORT_PROVIDES_HXX_
25 #define _PARAM_DOUBLE_PORT_PROVIDES_HXX_
26
27 #include "SALOME_ParamPortsPaCO_Ports_Param_Double_Port_server.hxx"
28
29 #include "ParallelDSC_i.hxx"
30 #include "PortProperties_i.hxx"
31
32 class Param_Double_Port_provides_i :
33   public virtual Ports::Param_Double_Port_serv
34 {
35   public :
36     Param_Double_Port_provides_i(CORBA::ORB_ptr orb, char * ior, int rank);
37     virtual ~Param_Double_Port_provides_i();
38
39     void put(const Ports::Param_Double_Port::seq_double & param_data);
40     void get_results(Ports::Param_Double_Port::seq_double_out param_results);
41
42     // local methods
43     Ports::Param_Double_Port::seq_double * get_data();
44     void set_data(Ports::Param_Double_Port::seq_double * results);
45     void configure_set_data(int data_length, 
46                             int totalNbElt, 
47                             int BeginEltPos);
48
49     // Aide à la création du port
50     static Param_Double_Port_provides_i * init_port(Engines_ParallelDSC_i * par_compo, 
51                                                     std::string port_name,
52                                                     CORBA::ORB_ptr orb);
53
54     // Méthode temporaire en attendant d'avoir des méthodes parallèles bien synchronisé
55     static void wait_init_port(Engines_ParallelDSC_i * par_compo, 
56                                std::string port_name,
57                                CORBA::ORB_ptr orb);
58   private:
59     // Buffers pour la réception et l'envoi
60     Ports::Param_Double_Port::seq_double * _seq_data;
61     Ports::Param_Double_Port::seq_double * _seq_results;
62
63     // Variable pour la gestion du buffer de réception
64     pthread_mutex_t * seq_data_mutex;
65     pthread_cond_t * seq_data_condition;
66     bool seq_data_termine;
67     pthread_mutex_t * seq_data_mutex_cp;
68     pthread_cond_t * seq_data_condition_cp;
69     bool seq_data_termine_cp;
70
71     // Variable pour la gestion du buffer d'envoi
72     pthread_mutex_t * seq_results_mutex;
73     pthread_cond_t * seq_results_condition;
74     bool seq_results_termine;
75     pthread_mutex_t * seq_results_mutex_cp;
76     pthread_cond_t * seq_results_condition_cp;
77     bool seq_results_termine_cp;
78 };
79 #endif