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);
112 SALOME::CorbaLongCSender_ptr _this();
117 /*! Servant class of sender using MPI2.
119 class SALOME_MPISender_i : public virtual POA_SALOME::MPISender,
120 public virtual SALOME_Sender_i
123 static unsigned long _tag1;
124 static unsigned long _tag2;
125 /*! Name of the port opened*/
128 /*! Tag 1 that identifies the transfert*/
130 /*! Tag 2 that identifies the transfert*/
132 /*! MPI communicator*/
134 /*! Array of pointer for asynchronous invocation with omnithread*/
136 /*! Pointer to thread created on asynchronous invocation*/
137 omni_thread *_newThr;
138 /*! Type the component of the array*/
139 SALOME::TypeOfDataTransmitted _type;
141 SALOME_MPISender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend=false);
142 ~SALOME_MPISender_i();
143 SALOME::MPISender::param* getParam();
145 void close(const SALOME::MPISender::param& p);
147 static void* myThread(void *args);
150 class SALOME_MPISenderDouble_i : public POA_SALOME::MPISenderDouble,
151 public SALOME_SenderDouble_i,
152 public SALOME_MPISender_i
155 SALOME_MPISenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
158 class SALOME_MPISenderInt_i : public POA_SALOME::MPISenderInt,
159 public SALOME_SenderInt_i,
160 public SALOME_MPISender_i
163 SALOME_MPISenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
170 /*! Servant class of sender using Sockets.
172 class SALOME_SocketSender_i : public virtual POA_SALOME::SocketSender,
173 public virtual SALOME_Sender_i
179 std::string _IPAddress;
181 omni_thread *_newThr;
183 /*! Type the component of the array*/
184 SALOME::TypeOfDataTransmitted _type;
186 SALOME_SocketSender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend=false);
187 ~SALOME_SocketSender_i();
188 SALOME::SocketSender::param* getParam();
190 void initCom() throw(SALOME::SALOME_Exception);
191 void acceptCom() throw(SALOME::SALOME_Exception);
195 static void* myThread(void *args);
196 std::string inetAddress();
199 class SALOME_SocketSenderDouble_i : public POA_SALOME::SocketSenderDouble,
200 public SALOME_SenderDouble_i,
201 public SALOME_SocketSender_i
204 SALOME_SocketSenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
207 class SALOME_SocketSenderInt_i : public POA_SALOME::SocketSenderInt,
208 public SALOME_SenderInt_i,
209 public SALOME_SocketSender_i
212 SALOME_SocketSenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);