]> SALOME platform Git repositories - modules/yacs.git/blob - src/Communication/Receivers.hxx
Salome HOME
Copyrights update
[modules/yacs.git] / src / Communication / Receivers.hxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/
19 //
20 #ifndef _RECEIVERS_HXX_
21 #define _RECEIVERS_HXX_
22
23 #ifdef HAVE_MPI2
24 #include "mpi.h"
25 #endif
26 #include "SALOME_Comm_i.hxx"
27 #include "Receiver.hxx"
28
29 /*!
30   Receiver used for transfert with CORBA when no copy is required remotely and locally.
31  */
32 template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
33 class CorbaNCNoCopyReceiver : public Receiver<T,servForT,ptrForT>
34 {
35 private:
36   CorbaSender _mySender;
37 public:
38   CorbaNCNoCopyReceiver(CorbaSender mySender);
39   ~CorbaNCNoCopyReceiver();
40   T *getValue(long &size);
41 private:
42   T *getDistValue(long &size);
43 };
44
45 /*!
46   Receiver used for transfert with CORBA when copy is not required remotely but required locally.
47  */
48 template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
49 class CorbaNCWithCopyReceiver : public Receiver<T,servForT,ptrForT>
50 {
51 private:
52   CorbaSender _mySender;
53 public:
54   CorbaNCWithCopyReceiver(CorbaSender mySender);
55   ~CorbaNCWithCopyReceiver();
56   T *getValue(long &size);
57 private:
58   T *getDistValue(long &size);
59 };
60
61 /*!
62   Receiver used for transfert with CORBA when copy is required remotely but not required locally.
63  */
64 template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
65 class CorbaWCNoCopyReceiver : public Receiver<T,servForT,ptrForT>
66 {
67 private:
68   CorbaSender  _mySender;
69 public:
70   CorbaWCNoCopyReceiver(CorbaSender mySender);
71   ~CorbaWCNoCopyReceiver();
72   T *getValue(long &size);
73 private:
74   T *getDistValue(long &size);
75 };
76
77 /*!
78   Receiver used for transfert with CORBA when copy is required both remotely and locally.
79  */
80 template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
81 class CorbaWCWithCopyReceiver : public Receiver<T,servForT,ptrForT>
82 {
83 private:
84   CorbaSender _mySender;
85 public:
86   CorbaWCWithCopyReceiver(CorbaSender mySender);
87   ~CorbaWCWithCopyReceiver();
88   T *getValue(long &size);
89 private:
90   T *getDistValue(long &size);
91 };
92
93 #ifdef HAVE_MPI2
94 /*!
95   Receiver for MPI transfert.
96  */
97 template<class T,MPI_Datatype T2,class CorbaSender,class servForT,class ptrForT>
98 class MPIReceiver : public Receiver<T,servForT,ptrForT>
99 {
100 private:
101   CorbaSender _mySender;
102 public:
103   MPIReceiver(CorbaSender mySender);
104   ~MPIReceiver();
105   T *getValue(long &size);
106 private:
107   T *getDistValue(long &size);
108 };
109 #endif
110
111 #ifdef HAVE_SOCKET
112
113 class XDR;
114
115 /*!
116   Receiver for transfert with sockets.
117  */
118 template<class T,int (*myFunc)(XDR*,T*),class CorbaSender,class servForT,class ptrForT>
119 class SocketReceiver : public Receiver<T,servForT,ptrForT>
120 {
121 private:
122   CorbaSender _mySender;
123   int _clientSockfd;
124   bool _senderDestruc;
125 public:
126   SocketReceiver(CorbaSender mySender);
127   ~SocketReceiver();
128   T *getValue(long &size);
129 private:
130   T *getDistValue(long &size);
131   void initCom();
132   void connectCom(const char *, int);
133   void closeCom();
134 };
135 #endif
136
137 #include "Receivers.cxx"
138
139 #endif
140