Salome HOME
PR: merge from branch BR_UT_V310a2 tag BR_UT_V310a2_20051115
[modules/kernel.git] / src / Communication / SenderFactory.hxx
1 #ifndef _SENDERFACTORY_HXX_
2 #define _SENDERFACTORY_HXX_
3
4 #include "MultiCommException.hxx"
5 #include <SALOMEconfig.h>
6 #include CORBA_SERVER_HEADER(SALOME_Comm)
7
8 class SALOMEMultiComm;
9
10 class SALOME_SenderDouble_i;
11 class SALOME_SenderInt_i;
12
13 /*!
14   This class implements the factory pattern of GoF by making a sender by giving an array and a communicator.It completely hides the type of sender from the user.
15  */
16 class SenderFactory
17 {
18 public:
19   static SALOME::SenderDouble_ptr buildSender(SALOMEMultiComm &multiCommunicator,const double *tab,long lgr,bool ownTab=false) throw(MultiCommException);
20   static SALOME::SenderInt_ptr buildSender(SALOMEMultiComm &multiCommunicator,const int *tab,long lgr,bool ownTab=false) throw(MultiCommException);
21   static SALOME::SenderDouble_ptr buildSender(SALOME::TypeOfCommunication NewType,SALOME_SenderDouble_i *src);
22   static SALOME::SenderInt_ptr buildSender(SALOME::TypeOfCommunication NewType,SALOME_SenderInt_i *src);
23 };
24
25 template<class T>
26 struct mapCppSender {
27   typedef T SenderVarType;
28 };
29
30 template<>
31 struct mapCppSender<int>
32 {
33   typedef SALOME::SenderInt_var SenderVarType;
34 };
35
36 template<>
37 struct mapCppSender<double>
38 {
39   typedef SALOME::SenderDouble_var SenderVarType;
40 };
41
42 #endif
43