1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "SALOME_Comm_i.hxx"
24 #include "SenderFactory.hxx"
25 #include "utilities.h"
26 #include "SALOMEMultiComm.hxx"
28 #ifdef COMP_CORBA_DOUBLE
29 #define SALOME_CorbaDoubleSender SALOME_CorbaDoubleNCSender_i
31 #define SALOME_CorbaDoubleSender SALOME_CorbaDoubleCSender_i
34 #ifdef COMP_CORBA_LONG
35 #define SALOME_CorbaLongSender SALOME_CorbaLongNCSender_i
37 #define SALOME_CorbaLongSender SALOME_CorbaLongCSender_i
40 SALOME::SenderDouble_ptr SenderFactory::buildSender(SALOMEMultiComm &multiCommunicator,const double *tab,long lgr,bool ownTab)throw(MultiCommException){
41 switch(multiCommunicator.getProtocol())
45 SALOME_CorbaDoubleSender * retc=new SALOME_CorbaDoubleSender(tab,lgr,ownTab);
51 SALOME_MPISenderDouble_i* retm=new SALOME_MPISenderDouble_i(tab,lgr,ownTab);
58 SALOME_SocketSenderDouble_i* rets=new SALOME_SocketSenderDouble_i(tab,lgr,ownTab);
64 multiCommunicator.setProtocol(SALOME::CORBA_);
65 MESSAGE("PROTOCOL CHANGED TO CORBA");
66 SALOME_CorbaDoubleSender * retc=new SALOME_CorbaDoubleSender(tab,lgr,ownTab);
69 // throw MultiCommException("Communication protocol not implemented");
73 SALOME::SenderInt_ptr SenderFactory::buildSender(SALOMEMultiComm &multiCommunicator,const int *tab,long lgr,bool ownTab)throw(MultiCommException){
74 switch(multiCommunicator.getProtocol())
78 SALOME_CorbaLongSender * retc=new SALOME_CorbaLongSender(tab,lgr,ownTab);
84 SALOME_MPISenderInt_i* retm=new SALOME_MPISenderInt_i(tab,lgr,ownTab);
91 SALOME_SocketSenderInt_i* rets=new SALOME_SocketSenderInt_i(tab,lgr,ownTab);
97 multiCommunicator.setProtocol(SALOME::CORBA_);
98 SALOME_CorbaLongSender * retc=new SALOME_CorbaLongSender(tab,lgr,ownTab);
101 // throw MultiCommException("Communication protocol not implemented");
105 SALOME::SenderDouble_ptr SenderFactory::buildSender(SALOME::TypeOfCommunication NewType,SALOME_SenderDouble_i *src)
107 SALOMEMultiComm mc(NewType);
109 const double *data=(const double *)src->getData(n);
110 bool own=src->getOwnerShip();
111 src->setOwnerShip(false);
112 return buildSender(mc,data,n,own);
115 SALOME::SenderInt_ptr SenderFactory::buildSender(SALOME::TypeOfCommunication NewType,SALOME_SenderInt_i *src)
117 SALOMEMultiComm mc(NewType);
119 const int *data=(const int *)src->getData(n);
120 bool own=src->getOwnerShip();
121 src->setOwnerShip(false);
122 return buildSender(mc,data,n,own);