Salome HOME
Corrected following ABV remark - #define should be put outside %{ ... %} block in...
[modules/kernel.git] / idl / SALOME_Component.idl
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 // 
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. 
8 // 
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. 
13 // 
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 
17 // 
18 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
19 //
20 //
21 //
22 //  File   : SALOME_Component.idl
23 //  Author : Paul RASCLE, EDF
24 //  $Header: 
25
26 #ifndef _SALOME_COMPONENT_IDL_
27 #define _SALOME_COMPONENT_IDL_
28 /*!  
29 This is a package of interfaces used for connecting new components to %SALOME
30 application. It also contains a set of interfaces used for management of %MED
31 component in %SALOME application.
32 */
33 module Engines
34 {
35   /*! 
36     A byte stream which is used for binary data transfer between different
37     components
38   */
39   typedef sequence<octet> TMPFile;  
40   
41   /*!
42     General Key Value Structure to set or get properties, for component
43   */
44   struct KeyValuePair
45   {
46     string key;
47     any value;
48   };
49
50   typedef sequence<KeyValuePair> FieldsDict;
51
52   interface Component ;
53
54   /*! \brief Interface of the %Container
55   This interface defines the process of loading and registration
56   of new components in %SALOME application
57   */
58
59   interface Container
60   {
61
62     /*!
63       Loads a new component class (dynamic library).
64       \param componentName like COMPONENT, (Python or C++ implementation)
65                            try to make a Python import of COMPONENT,
66                            then a lib open of libCOMPONENTEngine.so
67       \return true if load successfull or already done, false otherwise
68     */
69     boolean load_component_Library(in string componentName);
70
71     /*!
72       Creates a new servant instance of a component.
73       Component library must be loaded.
74       \param componentName Name of the component which will be registered
75                            in Registry and Name Service,
76                          (instance number suffix added to the registered name)
77       \param studyId        0 if instance is not associated to a study, 
78                             >0 otherwise (== study id)
79       \return a loaded component
80     */
81     Component create_component_instance(in string componentName,
82                                         in long studyId);
83
84     /*!
85       Finds a servant instance of a component
86       \param registeredName  Name of the component in Registry or Name Service,
87                              without instance suffix number
88       \param studyId        0 if instance is not associated to a study, 
89                             >0 otherwise (== study id)
90       \return the first instance found with same studyId
91     */
92     Component find_component_instance(in string registeredName,
93                                       in long studyId);
94
95     /*!
96       Find a servant instance of a component, or create a new one.
97       Loads the component library if needed.
98       Only applicable to multiStudy components.
99       \param nameToRegister Name of the component which will be registered
100                             in Registry (or Name Service)
101       \param componentName  Name of the constructed library of the %component
102                             (not used any more, give empty string)
103       \return a loaded component
104     */
105     Component load_impl(in string nameToRegister,
106                         in string componentName);
107
108     /*!
109       Stops the component servant, and deletes all related objects
110       \param component_i     Component to be removed
111     */
112     void remove_impl(in Component component_i);
113
114     /*!
115       Discharges all components from the container.
116     */
117     void finalize_removal() ;
118
119     /*!
120       Determines whether the server has been loaded or not.
121     */
122     void ping();
123
124     /*!
125       Name of the %container
126     */
127     readonly attribute string name ;
128
129     /*!
130       Shutdown the Container process.
131     */
132     oneway void Shutdown();
133
134     /*!
135       Returns the hostname of the container
136     */
137     string getHostName();
138
139     /*!
140       Returns the PID of the container
141     */
142     long getPID();
143
144     /*!
145       Returns True if the %container has been killed.
146       Kept for Superv compilation but can't work, unless oneway...
147       TO REMOVE !
148     */
149     boolean Kill_impl() ;
150
151     // -------------------------- removed -------------------------------
152
153     /*!
154       Loads into the container a new component, registers it and starts it's
155       CORBA servant.
156       \param nameToRegister    Name used to register in Naming Service,
157                                the component instance 
158       \param componentName     Name of the %component
159       \return a new instance of the component or the registered component
160                if already registered or Nil if not possible
161     */
162     //    Component instance(in string nameToRegister, in string componentName);
163
164
165     /*!
166       Name of the machine containing this container (location of the container).
167     */
168     //    readonly attribute string machineName ;
169
170
171   };
172
173
174
175   /*! \brief Interface of the %component
176   This interface is used for interaction between the %container and the
177   %component and between the components inside the container.
178   */
179   interface Component
180   {
181     /*!
182       The name of the instance of the %Component
183     */
184     readonly attribute string instanceName ;
185
186     /*!
187       The name of the interface of the %Component
188     */
189     readonly attribute string interfaceName ;
190
191     /*!
192       Determines whether the server has already been loaded or not.
193     */
194     void ping();
195
196 //     /*!
197 //       Set study associated to component instance
198 //       \param studyId
199 //       (=0:  multistudy component instance,
200 //        >0: study id associated to this instance
201 //       \return false if already set with a different value (change not possible)
202 //     */
203 //     boolean setStudyId(in long studyId);
204
205     /*!
206       get study associated to component instance
207       \return -1: not initialised (Internal Error)
208                0: multistudy component instance
209               >0: study id associated to this instance
210     */
211     long getStudyId();
212
213     /*!
214       Deactivates the %Component.
215       -- TO BE USED BY CONTAINER ONLY (Container housekeeping) --
216       use remove_impl from Container instead !
217     */
218     void destroy() ;
219
220     /*!
221       Returns the container that the %Component refers to.
222     */
223     Container GetContainerRef() ;
224
225     /*!
226       Gives a sequence of (key=string,value=any) to the component. 
227       Base class component stores the sequence in a map.
228       The map is cleared before.
229       This map is for use by derived classes. 
230     */
231     void setProperties(in FieldsDict dico);
232
233     /*!
234       returns a previously stored map (key=string,value=any) as a sequence.
235       See setProperties(in FieldsDict dico).
236     */
237     FieldsDict getProperties();
238
239     /*!
240       This method is used by the %SUPERVISOR component. It sets the names of
241       the graph and of the node.
242       \param aGraphName Name of graph
243       \param aNodeName  Name of node
244     */
245     void Names( in string aGraphName , in string aNodeName ) ;
246
247     /*!
248       Returns True if the %Component has been killed.
249     */
250     boolean Kill_impl() ;
251
252     /*!
253       Returns True if the activity of the %Component has been stopped.
254       (It's action can't be resumed)
255     */
256     boolean Stop_impl() ;
257
258     /*!
259       Returns True if the activity of the %Component has been suspended.
260       (It's action can be resumed)
261     */
262     boolean Suspend_impl() ;
263
264     /*!
265       Returns True if the activity of the %Component has been resumed.
266     */
267     boolean Resume_impl() ;
268
269     /*!
270       Returns the Cpu used (long does not run with python !...)
271     */
272     long CpuUsed_impl() ;
273     
274     /*!
275       Returns a python script, which is being played back reproduces
276       the data model of component
277     */    
278     TMPFile DumpPython(in Object theStudy,
279                        in boolean isPublished, 
280                        out boolean isValidScript); 
281
282   } ;
283 } ;
284
285 #endif