1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "SALOME_Comm_i.hxx"
21 #include "SenderFactory.hxx"
22 #include "utilities.h"
23 #include "SALOMEMultiComm.hxx"
26 #ifdef COMP_CORBA_DOUBLE
27 #define SALOME_CorbaDoubleSender SALOME_CorbaDoubleNCSender_i
29 #define SALOME_CorbaDoubleSender SALOME_CorbaDoubleCSender_i
32 #ifdef COMP_CORBA_LONG
33 #define SALOME_CorbaLongSender SALOME_CorbaLongNCSender_i
35 #define SALOME_CorbaLongSender SALOME_CorbaLongCSender_i
38 SALOME::SenderDouble_ptr SenderFactory::buildSender(SALOMEMultiComm &multiCommunicator,const double *tab,long lgr,bool ownTab)throw(MultiCommException){
39 switch(multiCommunicator.getProtocol())
43 SALOME_CorbaDoubleSender * retc=new SALOME_CorbaDoubleSender(tab,lgr,ownTab);
49 SALOME_MPISenderDouble_i* retm=new SALOME_MPISenderDouble_i(tab,lgr,ownTab);
56 SALOME_SocketSenderDouble_i* rets=new SALOME_SocketSenderDouble_i(tab,lgr,ownTab);
62 multiCommunicator.setProtocol(SALOME::CORBA_);
63 MESSAGE("PROTOCOL CHANGED TO CORBA");
64 SALOME_CorbaDoubleSender * retc=new SALOME_CorbaDoubleSender(tab,lgr,ownTab);
67 // throw MultiCommException("Communication protocol not implemented");
71 SALOME::SenderInt_ptr SenderFactory::buildSender(SALOMEMultiComm &multiCommunicator,const int *tab,long lgr,bool ownTab)throw(MultiCommException){
72 switch(multiCommunicator.getProtocol())
76 SALOME_CorbaLongSender * retc=new SALOME_CorbaLongSender(tab,lgr,ownTab);
82 SALOME_MPISenderInt_i* retm=new SALOME_MPISenderInt_i(tab,lgr,ownTab);
89 SALOME_SocketSenderInt_i* rets=new SALOME_SocketSenderInt_i(tab,lgr,ownTab);
95 multiCommunicator.setProtocol(SALOME::CORBA_);
96 SALOME_CorbaLongSender * retc=new SALOME_CorbaLongSender(tab,lgr,ownTab);
99 // throw MultiCommException("Communication protocol not implemented");
103 SALOME::SenderDouble_ptr SenderFactory::buildSender(SALOME::TypeOfCommunication NewType,SALOME_SenderDouble_i *src)
105 SALOMEMultiComm mc(NewType);
107 const double *data=(const double *)src->getData(n);
108 bool own=src->getOwnerShip();
109 src->setOwnerShip(false);
110 return buildSender(mc,data,n,own);
113 SALOME::SenderInt_ptr SenderFactory::buildSender(SALOME::TypeOfCommunication NewType,SALOME_SenderInt_i *src)
115 SALOMEMultiComm mc(NewType);
117 const int *data=(const int *)src->getData(n);
118 bool own=src->getOwnerShip();
119 src->setOwnerShip(false);
120 return buildSender(mc,data,n,own);