Version: 9.16.0
SALOME_Comm_i.hxx
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5//
6// This library is free software; you can redistribute it and/or
7// modify it under the terms of the GNU Lesser General Public
8// License as published by the Free Software Foundation; either
9// version 2.1 of the License, or (at your option) any later version.
10//
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public
17// License along with this library; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19//
20// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21//
22
23#ifndef _SALOME_COMM_I_HXX_
24#define _SALOME_COMM_I_HXX_
25
27
28#ifdef HAVE_MPI2
29#include "mpi.h"
30#endif
31#include <string>
32#include <SALOMEconfig.h>
33#include CORBA_SERVER_HEADER(SALOME_Comm)
34
35#define TIMEOUT 20
36
37
42class COMMUNICATION_EXPORT SALOME_Sender_i : public virtual POA_SALOME::Sender
43{
44protected:
46 const void *_tabToSend;
55
56 SALOME_Sender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend=false);
57public:
58 const void *getData(long &size) const;
59 int getSizeOf() const;
60 void setOwnerShip(bool own);
61 bool getOwnerShip() const { return _ownTabToSend; }
62 void release();
63 virtual ~SALOME_Sender_i() {}
64};
65
66class COMMUNICATION_EXPORT SALOME_SenderDouble_i : public virtual POA_SALOME::SenderDouble,
67 public virtual SALOME_Sender_i
68{
69public:
70 SALOME_SenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
72 SALOME::SenderDouble_ptr buildOtherWithProtocol(SALOME::TypeOfCommunication type);
73 virtual ~SALOME_SenderDouble_i();
74 static SALOME_SenderDouble_i *find(SALOME::SenderDouble_ptr pCorba);
75};
76
77class COMMUNICATION_EXPORT SALOME_SenderInt_i : public virtual POA_SALOME::SenderInt,
78 public virtual SALOME_Sender_i
79{
80public:
81 SALOME_SenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
83 SALOME::SenderInt_ptr buildOtherWithProtocol(SALOME::TypeOfCommunication type);
84 virtual ~SALOME_SenderInt_i();
85 static SALOME_SenderInt_i *find(SALOME::SenderInt_ptr pCorba);
86};
87
90class COMMUNICATION_EXPORT SALOME_CorbaDoubleNCSender_i : public POA_SALOME::CorbaDoubleNCSender,
92{
93public:
94 SALOME_CorbaDoubleNCSender_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
96 CORBA::ULong getSize();
97 SALOME::vectorOfDouble* sendPart(CORBA::ULong offset, CORBA::ULong length);
99};
100
103class COMMUNICATION_EXPORT SALOME_CorbaDoubleCSender_i : public POA_SALOME::CorbaDoubleCSender,
105{
106public:
107 SALOME_CorbaDoubleCSender_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
109 CORBA::ULong getSize();
110 SALOME::vectorOfDouble* sendPart(CORBA::ULong offset, CORBA::ULong length);
111};
112
115class COMMUNICATION_EXPORT SALOME_CorbaLongNCSender_i : public POA_SALOME::CorbaLongNCSender,
116 public SALOME_SenderInt_i
117{
118public:
119 SALOME_CorbaLongNCSender_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
121 CORBA::ULong getSize();
122 SALOME::vectorOfLong* sendPart(CORBA::ULong offset, CORBA::ULong length);
123 SALOME::vectorOfLong* send();
124};
125
128class COMMUNICATION_EXPORT SALOME_CorbaLongCSender_i : public POA_SALOME::CorbaLongCSender,
129 public SALOME_SenderInt_i
130{
131public:
132 SALOME_CorbaLongCSender_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
134 CORBA::ULong getSize();
135 SALOME::vectorOfLong* sendPart(CORBA::ULong offset, CORBA::ULong length);
136};
137
138#ifdef HAVE_MPI2
139
142class COMMUNICATION_EXPORT SALOME_MPISender_i : public virtual POA_SALOME::MPISender,
143 public virtual SALOME_Sender_i
144{
145private:
146 static unsigned long _tag1;
147 static unsigned long _tag2;
149 char *_portName;
150 int _cproc;
152 int _tag1Inst;
154 int _tag2Inst;
156 MPI_Comm _com;
158 void **_argsForThr;
160 omni_thread *_newThr;
163public:
164 SALOME_MPISender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend=false);
165 ~SALOME_MPISender_i();
166 SALOME::MPISender::param* getParam();
167 void send();
168 void close(const SALOME::MPISender::param& p);
169private:
170 static void* myThread(void *args);
171};
172
173class COMMUNICATION_EXPORT SALOME_MPISenderDouble_i : public POA_SALOME::MPISenderDouble,
175 public SALOME_MPISender_i
176{
177public:
178 SALOME_MPISenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
179};
180
181class COMMUNICATION_EXPORT SALOME_MPISenderInt_i : public POA_SALOME::MPISenderInt,
182 public SALOME_SenderInt_i,
183 public SALOME_MPISender_i
184{
185public:
186 SALOME_MPISenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
187};
188
189#endif
190
191#ifdef HAVE_SOCKET
192
195class COMMUNICATION_EXPORT SALOME_SocketSender_i : public virtual POA_SALOME::SocketSender,
196 public virtual SALOME_Sender_i
197{
198private:
199 int _serverSockfd;
200 int _clientSockfd;
201 int _port;
202 std::string _IPAddress;
203 void **_argsForThr;
204 omni_thread *_newThr;
205 bool _errorFlag;
208public:
209 SALOME_SocketSender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend=false);
210 ~SALOME_SocketSender_i();
211 SALOME::SocketSender::param* getParam();
212 void send();
213 void initCom();
214 void acceptCom();
215 void endOfCom();
216 void closeCom();
217private:
218 static void* myThread(void *args);
219 std::string inetAddress();
220};
221
222class COMMUNICATION_EXPORT SALOME_SocketSenderDouble_i : public POA_SALOME::SocketSenderDouble,
224 public SALOME_SocketSender_i
225{
226public:
227 SALOME_SocketSenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
228};
229
230class COMMUNICATION_EXPORT SALOME_SocketSenderInt_i : public POA_SALOME::SocketSenderInt,
231 public SALOME_SenderInt_i,
232 public SALOME_SocketSender_i
233{
234public:
235 SALOME_SocketSenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
236};
237
238#endif
239
240#endif
241
#define COMMUNICATION_EXPORT
Definition: SALOME_Communication.hxx:37
Servant class for CORBA sender for double* when copy of array _tabToSend is required,...
Definition: SALOME_Comm_i.hxx:105
Servant class for CORBA sender for double* when no copy of array _tabToSend is required,...
Definition: SALOME_Comm_i.hxx:92
Servant class for CORBA sender for int* when copy of array _tabToSend is required,...
Definition: SALOME_Comm_i.hxx:130
Servant class for CORBA sender for int* when no copy of array _tabToSend is required,...
Definition: SALOME_Comm_i.hxx:117
Definition: SALOME_Comm_i.hxx:68
SALOME::TypeOfDataTransmitted getTypeOfDataTransmitted()
Definition: SALOME_Comm_i.hxx:71
Definition: SALOME_Comm_i.hxx:79
SALOME::TypeOfDataTransmitted getTypeOfDataTransmitted()
Definition: SALOME_Comm_i.hxx:82
Generic servant class for senders that factorizes all the common methods and attributes necessary to ...
Definition: SALOME_Comm_i.hxx:43
bool _ownTabToSend
Indicates if _tabToSend has to be deallocated.
Definition: SALOME_Comm_i.hxx:54
virtual ~SALOME_Sender_i()
Definition: SALOME_Comm_i.hxx:63
long _lgrTabToSend
Length of the generic array to transmit.
Definition: SALOME_Comm_i.hxx:48
const void * _tabToSend
Pointer to the generic array to transmit.
Definition: SALOME_Comm_i.hxx:46
int _sizeOf
it represents the sizeof() of each component of the generic array: Practically in terms of bytes the ...
Definition: SALOME_Comm_i.hxx:52
bool getOwnerShip() const
Definition: SALOME_Comm_i.hxx:61
sequence< long > vectorOfLong
Definition: SALOME_Comm.idl:42
TypeOfCommunication
Definition: SALOME_Comm.idl:38
TypeOfDataTransmitted
Definition: SALOME_Comm.idl:36
sequence< double > vectorOfDouble
Definition: SALOME_Comm.idl:40
args
Definition: pythfilter.py:547
Definition: SALOME_Comm.idl:95
Definition: SALOME_Comm.idl:113