Salome HOME
correct previous integration (Porting to Python 2.6)
[modules/kernel.git] / src / DSC / ParallelDSC / ParallelDSC_i.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : ParallelDSC_i.hxx
23 //  Author : AndrĂ© RIBES (EDF)
24 //  Module : KERNEL
25 //
26 #ifndef _PARALLEL_DSC_COMPONENT_I_HXX_
27 #define _PARALLEL_DSC_COMPONENT_I_HXX_
28
29 #include <iostream>
30 #include <map>
31
32 #include "DSC_interface.hxx"
33 #include "SALOME_ParallelComponent_i.hxx"
34
35 #include "SALOME_PACOExtensionPaCO_Engines_Parallel_DSC_server.hxx"
36 #include "SALOME_PortsPaCO.hxx"
37
38 class Engines_ParallelDSC_i: 
39   public virtual Engines_Parallel_Component_i,
40   public virtual Engines::Parallel_DSC_serv,
41   public virtual Engines_DSC_interface 
42 {
43 public:
44   Engines_ParallelDSC_i(CORBA::ORB_ptr orb, 
45                         char * ior,
46                         int rank,
47                         PortableServer::POA_ptr poa,
48                         PortableServer::ObjectId * contId,
49                         const char *instanceName,
50                         const char *interfaceName,
51                         bool notif = false);
52
53   virtual ~Engines_ParallelDSC_i();
54
55   
56   /*!
57    * \see Engines::DSC::add_provides_port
58    */
59   virtual void add_provides_port(Ports::Port_ptr ref, 
60                                  const char* provides_port_name,
61                                  Ports::PortProperties_ptr port_prop) 
62     throw (Engines::DSC::PortAlreadyDefined,
63            Engines::DSC::NilPort,
64            Engines::DSC::BadProperty) {
65       Engines_DSC_interface::add_provides_port(ref, 
66                                                provides_port_name,
67                                                port_prop);
68     }
69
70   /*!
71    * \see Engines::DSC::add_uses_port
72    */
73   virtual void add_uses_port(const char* repository_id, 
74                              const char* uses_port_name,
75                              Ports::PortProperties_ptr port_prop)
76     throw (Engines::DSC::PortAlreadyDefined,
77            Engines::DSC::BadProperty) {
78       Engines_DSC_interface::add_uses_port(repository_id, 
79                                            uses_port_name,
80                                            port_prop);
81     }
82
83   /*!
84    * \see Engines::DSC::get_provides_port
85    */
86   virtual Ports::Port_ptr get_provides_port(const char* provides_port_name,
87                                             const CORBA::Boolean connection_error) 
88     throw (Engines::DSC::PortNotDefined,
89            Engines::DSC::PortNotConnected) {
90       return Engines_DSC_interface::get_provides_port(provides_port_name,
91                                                       connection_error);
92     }
93
94   /*!
95    * \see Engines::DSC::get_uses_port
96    */
97   virtual Engines::DSC::uses_port * get_uses_port(const char* uses_port_name)
98     throw (Engines::DSC::PortNotDefined,
99            Engines::DSC::PortNotConnected) {
100       return Engines_DSC_interface::get_uses_port(uses_port_name);
101     }
102
103   /*!
104    * \see Engines::DSC::connect_provides_port
105    */
106   virtual void connect_provides_port(const char* provides_port_name)
107     throw (Engines::DSC::PortNotDefined) {
108       Engines_DSC_interface::connect_provides_port(provides_port_name);
109     }
110
111   /*!
112    * \see Engines::DSC::connect_uses_port
113    */
114   virtual void connect_uses_port(const char* uses_port_name,
115                                  Ports::Port_ptr provides_port_ref) 
116   throw (Engines::DSC::PortNotDefined,
117          Engines::DSC::BadPortType,
118          Engines::DSC::NilPort) {
119     Engines_DSC_interface::connect_uses_port(uses_port_name,
120                                              provides_port_ref);
121   }
122
123   /*!
124    * \see Engines::DSC::is_connected
125    */
126   virtual CORBA::Boolean is_connected(const char* port_name)
127     throw (Engines::DSC::PortNotDefined) {
128       return Engines_DSC_interface::is_connected(port_name);
129     }
130
131    /*!
132    * \see Engines::DSC::disconnect_provides_port
133    */
134   virtual void disconnect_provides_port(const char* provides_port_name,
135                                         const Engines::DSC::Message message)
136     throw (Engines::DSC::PortNotDefined,
137            Engines::DSC::PortNotConnected) {
138       Engines_DSC_interface::disconnect_provides_port(provides_port_name,
139                                                       message);
140     }
141
142    /*!
143    * \see Engines::DSC::disconnect_uses_port
144    */
145   virtual void disconnect_uses_port(const char* uses_port_name,
146                                     Ports::Port_ptr provides_port_ref,
147                                     const Engines::DSC::Message message)
148     throw (Engines::DSC::PortNotDefined,
149            Engines::DSC::PortNotConnected,
150            Engines::DSC::BadPortReference) {
151       Engines_DSC_interface::disconnect_uses_port(uses_port_name,
152                                                   provides_port_ref,
153                                                   message);
154     }
155
156   virtual Ports::PortProperties_ptr get_port_properties(const char* port_name)
157     throw (Engines::DSC::PortNotDefined) {
158       return Engines_DSC_interface::get_port_properties(port_name);
159     }
160   
161   /*!
162    * This method is used to register the proxy of the parallel port into
163    * all the nodes of the parallel component.
164    * 
165    * \param ref CORBA proxy reference.
166    * \param provides_port_name provides port associated with the proxy.
167    * \param port_prop port properties.
168    */
169   virtual void set_paco_proxy(CORBA::Object_ptr ref, 
170                               const char* provides_port_name,
171                               Ports::PortProperties_ptr port_prop);
172
173   /*! 
174    * This method is used by the node that want to add the parallel proxy port.
175    *
176    * \param ref CORBA proxy reference.
177    * \param provides_port_name provides port associated with the proxy.
178    *
179    * \return true if the proxy is correctly added.
180    */
181   virtual CORBA::Boolean add_parallel_provides_proxy_port(const CORBA::Object_ptr ref, 
182                                                           const char * provides_port_name,
183                                                           Ports::PortProperties_ptr port_prop);
184
185   /*! 
186    * This method by the nodes that do not add the proxy to wait is reference.
187    *
188    * \param provides_port_name provides port associated with the proxy.
189    *
190    * \return true if the proxy is correctly added.
191    */
192   virtual CORBA::Boolean add_parallel_provides_proxy_wait(const char * provides_port_name);
193
194   /*!
195    * Permits to add a parallel node of a parallel provides port.
196    *
197    * \param ref CORBA node reference.
198    * \param provides_port_name provides port associated with the node.
199    *
200    * \return true if the node is correctly added.
201    */
202   virtual CORBA::Boolean add_parallel_provides_node_port(Ports::Port_PaCO_ptr ref, 
203                                                          const char* provides_port_name);
204
205   /*!
206    * Used to get the proxy of the parallel port.
207    *
208    * \param provides_port_name name of the parallel provides port.
209    *
210    * \return IOR of the proxy.
211    */
212   virtual const char * get_proxy(const char* provides_port_name);
213
214 };
215
216 #endif