Back to index

salome-kernel  6.5.0
Receivers.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifndef _RECEIVERS_HXX_
00024 #define _RECEIVERS_HXX_
00025 
00026 #ifdef HAVE_MPI2
00027 #include "mpi.h"
00028 #endif
00029 #include "SALOME_Comm_i.hxx"
00030 #include "Receiver.hxx"
00031 
00035 template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
00036 class CorbaNCNoCopyReceiver : public Receiver<T,servForT,ptrForT>
00037 {
00038 private:
00039   CorbaSender _mySender;
00040 public:
00041   CorbaNCNoCopyReceiver(CorbaSender mySender);
00042   ~CorbaNCNoCopyReceiver();
00043   T *getValue(long &size);
00044 private:
00045   T *getDistValue(long &size);
00046 };
00047 
00051 template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
00052 class CorbaNCWithCopyReceiver : public Receiver<T,servForT,ptrForT>
00053 {
00054 private:
00055   CorbaSender _mySender;
00056 public:
00057   CorbaNCWithCopyReceiver(CorbaSender mySender);
00058   ~CorbaNCWithCopyReceiver();
00059   T *getValue(long &size);
00060 private:
00061   T *getDistValue(long &size);
00062 };
00063 
00067 template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
00068 class CorbaWCNoCopyReceiver : public Receiver<T,servForT,ptrForT>
00069 {
00070 private:
00071   CorbaSender  _mySender;
00072 public:
00073   CorbaWCNoCopyReceiver(CorbaSender mySender);
00074   ~CorbaWCNoCopyReceiver();
00075   T *getValue(long &size);
00076 private:
00077   T *getDistValue(long &size);
00078 };
00079 
00083 template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
00084 class CorbaWCWithCopyReceiver : public Receiver<T,servForT,ptrForT>
00085 {
00086 private:
00087   CorbaSender _mySender;
00088 public:
00089   CorbaWCWithCopyReceiver(CorbaSender mySender);
00090   ~CorbaWCWithCopyReceiver();
00091   T *getValue(long &size);
00092 private:
00093   T *getDistValue(long &size);
00094 };
00095 
00096 #ifdef HAVE_MPI2
00097 
00100 template<class T>
00101 struct MPITRAITS
00102 {
00103   static MPI_Datatype MpiType;
00104 };
00105 
00106 template<>
00107 MPI_Datatype MPITRAITS<double>::MpiType=MPI_DOUBLE;
00108 
00109 template<>
00110 MPI_Datatype MPITRAITS<int>::MpiType=MPI_INT;
00111 
00112 template<class T,class CorbaSender,class servForT,class ptrForT>
00113 class MPIReceiver : public Receiver<T,servForT,ptrForT>
00114 {
00115 private:
00116   CorbaSender _mySender;
00117 public:
00118   MPIReceiver(CorbaSender mySender);
00119   ~MPIReceiver();
00120   T *getValue(long &size);
00121 private:
00122   T *getDistValue(long &size);
00123 };
00124 #endif
00125 
00126 #ifdef HAVE_SOCKET
00127 
00128 class XDR;
00129 
00133 template<class T,int (*myFunc)(XDR*,T*),class CorbaSender,class servForT,class ptrForT>
00134 class SocketReceiver : public Receiver<T,servForT,ptrForT>
00135 {
00136 private:
00137   CorbaSender _mySender;
00138   int _clientSockfd;
00139   bool _senderDestruc;
00140 public:
00141   SocketReceiver(CorbaSender mySender);
00142   ~SocketReceiver();
00143   T *getValue(long &size);
00144 private:
00145   T *getDistValue(long &size);
00146   void initCom();
00147   void connectCom(const char *, int);
00148   void closeCom();
00149 };
00150 #endif
00151 
00152 #include "Receivers.cxx"
00153 
00154 #endif
00155