1 // Copyright (C) 2007-2008 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
22 // File : DSC_Engines.idl
23 // Author : Andre RIBES, EDF
26 #ifndef _DSC_ENGINES_IDL_
27 #define _DSC_ENGINES_IDL_
29 #include "SALOME_Component.idl"
30 #include "SALOME_Ports.idl"
33 This is a package that contains IDL interfaces that permits to add
34 a dynamic port model to the SALOME object model.
38 /*! \brief Interface of a DSC component.
40 This interface defines the operations needed to add a component model with dynamic port
41 declaration to the SALOME object model. A component is a black box that interacts with
42 other components only by his ports. A port represents a connection point for the component.
43 In this model, a port is a CORBA interface, so a CORBA object.
45 There is two ways for a component to interact with a port type :
46 - It implements the port : it means "the component provides an implementation of the
47 interface of the port". We design this kind of port as "provides ports". It provides an
48 interface to other components.
49 - It needs to use an object that provides the port interface. We say that the component uses this
50 port type. It is represented by a "uses" port. A uses port can be connected with a provides port
51 of the same interface type. When the connection is done, a component can use the "uses port" to use the
52 interface provided by the "provides port".
54 The interface DSC implements the component interface that containes the operations that are needed
55 to manage declarations into a component and connections between ports.
57 These operations are logicaly divided in two parts :
58 - First part permits to add an get ports of a component.
59 - Second part permits to connect/disconnect ports.
61 interface DSC : Engines::Component {
63 /*--------------------------------------------------------------------------------------------*/
64 /*-------------------------------------- Types Part ------------------------------------------*/
67 This sequence is a uses port. It's a sequence since a uses port can be
68 connected with x provides port. Sometimes this kind of uses port is called multiple port.
69 At this programming level, the user has to deal with the sequence. In the DSC_user
70 layer, the user only deals with one pointer.
72 typedef sequence<Ports::Port> uses_port;
75 This enumeration is used when the connection of a port (uses or provides)
76 is changed. This information is for the component's user code.
78 enum Message {AddingConnection,
83 This exception is raised when a port's name is gived before
84 it is added to the component.
86 exception PortNotDefined {};
89 This exception is raised if you try to add a port with the same
90 name than a previous defined port.
92 exception PortAlreadyDefined {};
95 This exception is raised when you try to use a port that is not connected.
97 exception PortNotConnected {};
100 This exception is raised if the type of the provides port is bad.
101 This exception contains a string that gives what type is expected
102 and the type that the operation received.
104 exception BadPortType {
110 Port's reference is Nil !
112 exception NilPort {};
115 Port's reference is not the right reference.
117 exception BadPortReference {};
120 Object porperty is not good for the port
122 exception BadProperty {};
125 /*--------------------------------------------------------------------------------------------*/
126 /*-------------------------------------- Operation Part --------------------------------------*/
129 This operation adds a provides port to the component.
131 \param ref port's Corba reference.
132 \param provides_port_name port's name.
133 \param port_prop port's property object.
135 \exception PortAlreadyDefined
137 \exception BadProperty
139 \note Notice that the name of the port is unique on a component. So if there is
140 a uses port that has the same name, the PortAlreadyDefined exception will be throw.
141 Also notice that each port as an object property that is associated with.
143 void add_provides_port(in Ports::Port ref,
144 in string provides_port_name,
145 in Ports::PortProperties port_prop) raises(PortAlreadyDefined,
150 This operation adds a uses port to the component.
152 \param repository_id port's Corba repository id.
153 Eg : IDL:toto.tata/MODULE/INTERFACE_NAME:1.0
154 \param uses_port_name port's name.
155 \param port_prop port's property object.
157 \exception PortAlreadyDefined
158 \exception BadProperty
160 \note Notice that the name of the port is unique on the component. So if there is
161 a provides port that has the same name, the PortAlreadyDefined exception will be throw.
162 Also notice that each port as an object property that is associated with.
164 void add_uses_port(in string repository_id,
165 in string uses_port_name,
166 in Ports::PortProperties port_prop) raises(PortAlreadyDefined,
170 This operation is used to get a provides port of the component.
171 It can be used by the framework or the component himself.
173 If it's the framework that wants the port, the reference has to be gived
174 even if the port is not connected (boolean connection_error to false).
175 Contrary, if it's the component that wants the port, the port is given
176 in most of cases only if it is connected (boolean connection_error to true).
177 Notice that you can choose the behaviour that you want.
179 \param provides_port_name port's name.
180 \param connection_error true if you want to wait that the port is connected with
182 \return port's Corba reference.
184 \exception PortNotDefined
185 \exception PortNotConnected
186 \exception BadPortType
189 Ports::Port get_provides_port(in string provides_port_name,
190 in boolean connection_error) raises(PortNotDefined,
195 This operation is used to get a uses port of the component.
196 It can be used by the framework or the component himself.
197 Actually, only the user layer of the component will use this operation.
198 A uses port could be obtained if and only if the uses port is connected. The sequence
199 contains all the connections since a uses port can have multiple connections.
201 There is a system of callbacks to prevent the user code that there is a new
202 (or a deletion) of a connection (see DSC_Callbacks class).
204 \param uses_port_name port's name.
205 \return uses port's sequence.
207 \exception PortNotDefined
208 \exception PortNotConnected
209 \exception BadPortType
213 uses_port get_uses_port(in string uses_port_name) raises(PortNotDefined,
219 This operation connects a provides port with a uses port.
221 \param provides_port_name provides port's name.
223 \exception PortNotDefined
225 \note Notice that the provides doesn't uses port names or component reference.
227 void connect_provides_port(in string provides_port_name) raises(PortNotDefined);
230 This operation connects a uses port with a provides port.
232 \param uses_port_name uses port's name.
233 \param provides_port_ref provides port's Corba reference.
235 \exception PortNotDefined
236 \exception BadPortType
239 void connect_uses_port(in string uses_port_name,
240 in Ports::Port provides_port_ref) raises(PortNotDefined,
244 This operation tests if a port is connected. You can test
245 a uses port or a provides port.
247 \param port_name port's name.
248 \return true if the uses port is connected.
250 \exception PortNotDefined
252 boolean is_connected(in string port_name) raises(PortNotDefined);
255 This operation disconnects a uses port to a provides port.
257 \param provides_port_name provides port's name.
258 \param message state associated with the disconnection.
260 \exception PortNotDefined
261 \exception PortNotConnected
263 void disconnect_provides_port(in string provides_port_name,
264 in Engines::DSC::Message message) raises(PortNotDefined,
268 This operation disconnects a provides port to a uses port.
270 \param uses_port_name uses port's name.
271 \param provides_port_ref CORBA reference of the provides port.
272 \param message state associated with the disconnection.
274 \exception PortNotDefined
275 \exception PortNotConnected
276 \exception BadPortReference
278 void disconnect_uses_port(in string uses_port_name,
279 in Ports::Port provides_port_ref,
280 in Engines::DSC::Message message) raises(PortNotDefined,
284 This operation permits to get port's property object.
286 \param port_name port's name.
287 \return properties object's CORBA reference.
289 \exception PortNotDefined
291 Ports::PortProperties get_port_properties(in string port_name) raises(PortNotDefined);
295 /*! \brief Interface of the ConnectionManager.
296 It is a helper object for connection operations.
297 The ConnectionManager is used like other services of SALOME (e.g ContainerManager).
299 interface ConnectionManager {
302 The Id gived to the disconnect method is bad.
307 A connection Id. It's unique.
309 typedef short connectionId;
312 This operation connects a uses port with a provides port.
314 \param uses_component The component that have the uses port.
315 \param uses_port_name uses port's name.
316 \param provides_component The component that have the provides port.
317 \param provides_port_name provides port's name.
319 \exception Engines::DSC::PortNotDefined
320 \exception Engines::DSC::BadPortType
321 \exception Engines::DSC::NilPort
323 \return the id of the connection that the ConnectionManager will use
324 to release this connection when the framework (or a user script, ...)
325 will call ConnectionManager::disconnect.
327 connectionId connect(in Engines::DSC uses_component,
328 in string uses_port_name,
329 in Engines::DSC provides_component,
330 in string provides_port_name) raises(Engines::DSC::PortNotDefined,
331 Engines::DSC::BadPortType,
332 Engines::DSC::NilPort);
335 This operation releases a connection that has been previously created by
336 the ConnectionManager.
338 \param id The id of the connection previously gived by the connect operation
339 of the ConnectionManager.
340 \param message state associated with the disconnection.
342 \exception Engines::ConnectionManager::BadId
344 void disconnect(in connectionId id,
345 in Engines::DSC::Message message) raises(Engines::ConnectionManager::BadId,
346 Engines::DSC::PortNotDefined,
347 Engines::DSC::PortNotConnected,
348 Engines::DSC::BadPortReference);
351 Shutdown the ConnectionManager process.
353 oneway void ShutdownWithExit();
356 Returns the PID of the connection manager
361 /*--------------------------------------------------------------------------------------------*/
363 /*! \brief Interface of the Superv_Component.
364 This interface is a DSC component that contains services for the SALOME module SUPERV.
365 This interface contains methods that are only in local (so they are described
366 and explained in the implementation class Superv_Component_i). These methods give access
367 to data-oriented ports provided by default by SALOME's kernel.
369 interface Superv_Component : Engines::DSC {
372 The SUPERV module call this method before starting the service. Thus the service
373 can add is dynamics ports before it is started.
375 \param service_name service's name.
376 \return true if the service is correctly initialised.
378 boolean init_service(in string service_name);
381 /*--------------------------------------------------------------------------------------------*/
383 /*! \brief Interface of a Parallel_DSC component.
384 This interface defines the operations needed to add a paco++ port
385 into a parallel DSC component.
387 interface Parallel_DSC : Engines::Superv_Component, Engines::Parallel_Component {
390 This operation gives the proxy node of a paco++ port to all the nodes.
391 Only a node of the parallel component is going to add a proxy object
392 with an internal method.
394 \param ref provides proxy port's reference.
395 \param provides_port_name provides port's name.
397 \see Engines_ParallelDSC_i::add_parallel_provides_proxy_port
399 void set_paco_proxy(in Object ref,
400 in string provides_port_name,
401 in Ports::PortProperties port_prop);