1 #ifndef _SALOME_COMM_I_HXX_
2 #define _SALOME_COMM_I_HXX_
5 #include <SALOMEconfig.h>
6 #include CORBA_SERVER_HEADER(SALOME_Comm)
15 Generic servant class for senders that factorizes all the common methods and attributes necessary to senders.
16 All servant classes for senders have to inheritate from it.
18 class SALOME_Sender_i : public virtual POA_SALOME::Sender,
19 public PortableServer::RefCountServantBase {
21 /*! Pointer to the generic array to transmit*/
22 const void *_tabToSend;
23 /*! Length of the generic array to transmit*/
25 /*! it represents the sizeof() of each component of the generic array:\n
26 Practically in terms of bytes the size to be transmitted is _lgrTabToSend*_sizeOf
29 /*! Indicates if _tabToSend has to be deallocated */
32 SALOME_Sender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend=false);
34 const void *getData(long &size) const;
35 int getSizeOf() const;
36 void setOwnerShip(bool own);
37 bool getOwnerShip() const { return _ownTabToSend; }
39 virtual ~SALOME_Sender_i() {}
42 class SALOME_SenderDouble_i : public virtual POA_SALOME::SenderDouble,
43 public virtual SALOME_Sender_i
46 SALOME_SenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
47 SALOME::TypeOfDataTransmitted getTypeOfDataTransmitted() { return SALOME::DOUBLE_; }
48 SALOME::SenderDouble_ptr buildOtherWithProtocol(SALOME::TypeOfCommunication type);
49 virtual ~SALOME_SenderDouble_i();
50 static SALOME_SenderDouble_i *find(SALOME::SenderDouble_ptr pCorba);
53 class SALOME_SenderInt_i : public virtual POA_SALOME::SenderInt,
54 public virtual SALOME_Sender_i
57 SALOME_SenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
58 SALOME::TypeOfDataTransmitted getTypeOfDataTransmitted() { return SALOME::INT_; }
59 SALOME::SenderInt_ptr buildOtherWithProtocol(SALOME::TypeOfCommunication type);
60 virtual ~SALOME_SenderInt_i();
61 static SALOME_SenderInt_i *find(SALOME::SenderInt_ptr pCorba);
64 /*! Servant class for CORBA sender for double* when no copy of array _tabToSend is required, that is to say double and CORBA::Double are binary equal.
66 class SALOME_CorbaDoubleNCSender_i : public POA_SALOME::CorbaDoubleNCSender,
67 public SALOME_SenderDouble_i
70 SALOME_CorbaDoubleNCSender_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
71 ~SALOME_CorbaDoubleNCSender_i();
72 CORBA::ULong getSize();
73 SALOME::vectorOfDouble* sendPart(CORBA::ULong offset, CORBA::ULong length);
74 SALOME::vectorOfDouble* send();
77 /*! Servant class for CORBA sender for double* when copy of array _tabToSend is required, that is to say double and CORBA::Double are NOT binary equal.
79 class SALOME_CorbaDoubleCSender_i : public POA_SALOME::CorbaDoubleCSender,
80 public SALOME_SenderDouble_i
83 SALOME_CorbaDoubleCSender_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
84 ~SALOME_CorbaDoubleCSender_i();
85 CORBA::ULong getSize();
86 SALOME::vectorOfDouble* sendPart(CORBA::ULong offset, CORBA::ULong length);
89 /*! Servant class for CORBA sender for int* when no copy of array _tabToSend is required, that is to say int and CORBA::Long are binary equal.
91 class SALOME_CorbaLongNCSender_i : public POA_SALOME::CorbaLongNCSender,
92 public SALOME_SenderInt_i
95 SALOME_CorbaLongNCSender_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
96 ~SALOME_CorbaLongNCSender_i();
97 CORBA::ULong getSize();
98 SALOME::vectorOfLong* sendPart(CORBA::ULong offset, CORBA::ULong length);
99 SALOME::vectorOfLong* send();
102 /*! Servant class for CORBA sender for int* when copy of array _tabToSend is required, that is to say int and CORBA::Long are NOT binary equal.
104 class SALOME_CorbaLongCSender_i : public POA_SALOME::CorbaLongCSender,
105 public SALOME_SenderInt_i
108 SALOME_CorbaLongCSender_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
109 ~SALOME_CorbaLongCSender_i();
110 CORBA::ULong getSize();
111 SALOME::vectorOfLong* sendPart(CORBA::ULong offset, CORBA::ULong length);
113 SALOME::CorbaLongCSender_ptr _this();
119 /*! Servant class of sender using MPI2.
121 class SALOME_MPISender_i : public virtual POA_SALOME::MPISender,
122 public virtual SALOME_Sender_i
125 static unsigned long _tag1;
126 static unsigned long _tag2;
127 /*! Name of the port opened*/
130 /*! Tag 1 that identifies the transfert*/
132 /*! Tag 2 that identifies the transfert*/
134 /*! MPI communicator*/
136 /*! Array of pointer for asynchronous invocation with omnithread*/
138 /*! Pointer to thread created on asynchronous invocation*/
139 omni_thread *_newThr;
140 /*! Type the component of the array*/
141 SALOME::TypeOfDataTransmitted _type;
143 SALOME_MPISender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend=false);
144 ~SALOME_MPISender_i();
145 SALOME::MPISender::param* getParam();
147 void close(const SALOME::MPISender::param& p);
149 static void* myThread(void *args);
152 class SALOME_MPISenderDouble_i : public POA_SALOME::MPISenderDouble,
153 public SALOME_SenderDouble_i,
154 public SALOME_MPISender_i
157 SALOME_MPISenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
160 class SALOME_MPISenderInt_i : public POA_SALOME::MPISenderInt,
161 public SALOME_SenderInt_i,
162 public SALOME_MPISender_i
165 SALOME_MPISenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
172 /*! Servant class of sender using Sockets.
174 class SALOME_SocketSender_i : public virtual POA_SALOME::SocketSender,
175 public virtual SALOME_Sender_i
181 std::string _IPAddress;
183 omni_thread *_newThr;
185 /*! Type the component of the array*/
186 SALOME::TypeOfDataTransmitted _type;
188 SALOME_SocketSender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend=false);
189 ~SALOME_SocketSender_i();
190 SALOME::SocketSender::param* getParam();
192 void initCom() throw(SALOME::SALOME_Exception);
193 void acceptCom() throw(SALOME::SALOME_Exception);
197 static void* myThread(void *args);
198 std::string inetAddress();
201 class SALOME_SocketSenderDouble_i : public POA_SALOME::SocketSenderDouble,
202 public SALOME_SenderDouble_i,
203 public SALOME_SocketSender_i
206 SALOME_SocketSenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
209 class SALOME_SocketSenderInt_i : public POA_SALOME::SocketSenderInt,
210 public SALOME_SenderInt_i,
211 public SALOME_SocketSender_i
214 SALOME_SocketSenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);