Salome HOME
sources v1.2
[modules/kernel.git] / idl / SALOMEDS.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   : SALOMEDS.idl
23 //  Author : Yves FRICAUD
24 //  $Header$
25
26 /*! \mainpage 
27     \image html Application-About.png
28     
29 */
30 /*! \page page1 Mapping of IDL definitions to Python language.
31 \section Intro Introduction
32 %SALOME PRO is a distributed client/server application using the Common Object Request Broker Architecture (CORBA).
33 CORBA architecture uses the Interface Definition Language (IDL), which specifies interfaces between CORBA objects. So with help of IDL 
34 CORBA's language independence is ensured . Because interfaces described in IDL can be mapped to the most of currently used programming languages, CORBA applications and components are thus
35 independent of the language(s) used to implement them. In other words, a client written in C++ can communicate with a server written in Java, which in turn can communicate with
36 another server written in COBOL, and so forth.
37
38 One important thing to remember about IDL is that it is not an implementation language. That is, applications can't be written in IDL. The sole purpose of IDL is to define interfaces;
39 providing implementations for these interfaces is performed using some other language.
40  
41 This page contains an abridged reference manual for mapping of IDL definitions to Python language. It will be useful for Python programmers who are not familiar 
42 with IDL language. All examples are taken from %SALOME PRO source files.
43 The complete version of Python Language Mapping Specification can be found <A HREF="http://www.omg.org">here.</A>
44
45 <BR><STRONG>CONTENTS:</STRONG>
46 - \ref subsection1
47 - \ref subsection2
48 - \ref subsection3
49 - \ref subsection4
50 - \ref subsection5
51 - \ref subsection6
52 - \ref subsection7
53
54 \subsection subsection1 Using Scoped Names
55
56 Python implements a module concept that is similar to the IDL scoping mechanisms,
57 except that it does not allow for nested modules. In addition, Python requires each
58 object to be implemented in a module; globally visible objects are not supported.
59
60 Because of these constraints, scoped names are translated into Python using the
61 following rules:
62
63 \95 An IDL module mapped into a Python module. Modules containing modules are
64 mapped to packages (i.e., directories with an <STRONG>__init__</STRONG> module containing all
65 definitions excluding the nested modules). An implementation can chose to map toplevel
66 definitions (including the module CORBA) to modules in an implementationdefined
67 package, to allow concurrent installations of different CORBA runtime
68 libraries. In that case, the implementation must provide additional modules so that
69 toplevel modules can be used without importing them from a package.
70
71 \95 For all other scopes, a Python class is introduced that contains all the definitions
72 inside this scope.
73
74 \95 Other global definitions (except modules) appear in a module whose name is
75 implementation dependent. Implementations are encouraged to use the name of the
76 IDL file when defining the name of that module.
77
78 For instance,
79
80 \verbatim
81 module SALOMEDS {
82  interface StudyManager {
83   void  Close(in Study aStudy);
84  };
85 };
86 \endverbatim 
87
88 would introduce a module SALOMEDS.py, which contains the following definitions:
89
90 \verbatim
91 # module SALOMEDS.py
92 class StudyManager:
93   def _Close(self,aStudy):
94    pass #interfaces are discussed later
95 \endverbatim
96
97 To avoid conflicts, IDL names that are also Python identifiers are prefixed with an underscore (\91_\92).
98
99 \subsection subsection2 Mapping for Template and Array Types
100
101 Both the bounded and the unbounded string type of IDL are mapped to the Python
102 string type. Wide strings are represented by an implementation-defined type with the
103 following properties:
104
105 \95 For the wide string X and the integer n, X[n] returns the nth character, which is a
106 wide string of length 1.
107
108 \95 len(X) returns the number of characters of wide string X.
109
110 \95 CORBA.wstr(c) returns a wide character with the code point c in an
111 implementation-defined encoding.
112
113 \95 X+Y returns the concatenation of wide strings X and Y.
114
115 \95 CORBA.word(CORBA.wstr(c)) == c
116
117 The sequence template is mapped to sequence objects (e.g., tuples or lists).
118 Applications should not assume that values of a sequence type are mutable. Sequences
119 and arrays of octets and characters are mapped to the string type for efficiency reasons.
120
121 For example, given the IDL definitions
122
123 \verbatim
124 module SALOMEDS {
125   typedef sequence <string> StringSeq;
126    
127    interface AttributeTableOfInteger : GenericAttribute {
128
129     void SetRowTitles(in StringSeq theTitles) raises(IncorrectArgumentLength);
130  };
131 };
132 \endverbatim
133
134 a client could invoke the operation
135
136 \verbatim
137 print My_AttributeTableOfInteger.SetRowTitles(["X","F"])
138 \endverbatim
139
140 Array types are mapped like sequence templates. The application in this example also expects an
141 IncorrectArgumentLength exception if it passes sequences that violate the bounds constraint or
142 arrays of wrong size.
143
144 Another example with arrays. The following IDL definition
145
146 \verbatim
147 module SALOMEDS {
148  typedef sequence<GenericAttribute> ListOfAttributes;
149  interface SObject {
150   ListOfAttributes     GetAllAttributes();
151  };
152 };
153 \endverbatim
154
155 is equal to 
156
157 \verbatim
158 import SALOMEDS
159
160 attributes=[]
161  
162 attributes = My_SObject.GetAllAttributes()
163
164 length = len(attributes)
165
166 print "Attributes number = ", length
167 print attributes
168 \endverbatim
169
170 \subsection subsection3 Mapping for Objects and Operations
171
172 A CORBA object reference is represented as a Python object at run-time. This object
173 provides all the operations that are available on the interface of the object. Although
174 this specification does not mandate the use of classes for stub objects, the following
175 discussion uses classes to indicate the interface.
176
177 The nil object is represented by <STRONG>None</STRONG>.
178
179 If an operation expects parameters of the IDL Object type, any Python object
180 representing an object reference might be passed as actual argument.
181
182 If an operation expects a parameter of an abstract interface, either an object
183 implementing that interface, or a value supporting this interface may be passed as
184 actual argument. The semantics of abstract values then define whether the argument is
185 passed by value or by reference.
186
187 Operations of an interface map to methods available on the object references.
188 Parameters with a parameter attribute of <STRONG>in</STRONG> or <STRONG>inout</STRONG> 
189 are passed from left to right tothe method, skipping <STRONG>out</STRONG> parameters.
190 The return value of a method depends on the number of <STRONG>out</STRONG> parameters 
191 and the return type. If the operation returns a value, this
192 value forms the first <VAR>result value</VAR>. All <STRONG>inout</STRONG> or <STRONG>out</STRONG> 
193 parameters form consecutive <VAR>result values</VAR>. The method result depends then on the number
194 of <VAR>result values</VAR>:
195
196 \95 If there is no <VAR>result value</VAR>, the method returns None.
197
198 \95 If there is exactly one <VAR>result value</VAR>, it is returned as a single value.
199
200 \95 If there is more than one <VAR>result value</VAR>, all of them are packed into a tuple, and this
201 tuple is returned.
202
203 Assuming the IDL definition
204
205 \verbatim
206 module SALOMEDS{
207  interface StudyBuilder{
208   boolean FindAttribute  ( in SObject anObject, 
209                            out GenericAttribute anAttribute, 
210                            in string aTypeOfAttribute );
211  };
212 };
213 \endverbatim
214                                           
215 a client could write
216
217 \verbatim
218 from SALOMEDS import StudyBuilder;
219 my_StudyBuilder=...
220   
221   res,A=my_StudyBuilder.FindAttribute(Sobj, "AttributeSequenceOfReal")
222 \endverbatim
223
224 In this example <STRONG>A</STRONG> corresponds to the return value <STRONG>anAttribute</STRONG> and  
225 <STRONG>res</STRONG> to the <STRONG>boolean</STRONG> return value. 
226
227 If an interface defines an <STRONG>attribute name</STRONG>, for example, the attribute is mapped into an
228 operation <STRONG>_get_name</STRONG>. If the attribute is not <STRONG>readonly</STRONG>, there is an
229 additional operation <STRONG>_set_name</STRONG>.
230
231 The IDL definition
232
233 \verbatim
234 module SALOMEDS{
235  interface Study{
236   attribute string Name;
237  };
238 };
239 \endverbatim
240
241 is equal to the following
242
243 \verbatim
244 from SALOMEDS import Study
245 My_Study=...
246   Name=My_Study._get_name();
247   Name=My_Study._set_name();
248 \endverbatim
249
250 \subsection subsection4 Narrowing Object References
251
252 Python objects returned from CORBA operations or pseudo-operations (such as
253 string_to_object) might have a dynamic type, which is more specific than the
254 static type as defined in the operation signature.
255
256 Since there is no efficient and reliable way of automatically creating the most specific
257 type, explicit narrowing is necessary. To narrow an object reference <STRONG>A</STRONG> to an interface
258 class <STRONG>AttributeSequenceOfReal</STRONG>, the client can use the following operation 
259
260 \verbatim
261 A = A._narrow(SALOMEDS.AttributeSequenceOfReal)
262 \endverbatim
263
264 \subsection subsection5 Mapping for Exceptions
265
266 An   IDL   exception   is   translated   into   a   Python  class  derived  from
267 CORBA.UserException.  System  exceptions are derived from CORBA.SystemException.
268 Both  base  classes  are  derived  from  CORBA.Exception.  The parameters of the
269 exception  are mapped in the same way as the fields of a struct definition. When
270 raising  an  exception,  a new instance of the class is created; the constructor
271 expects the exception parameters. For example, the definition
272
273 \verbatim
274 module SALOMEDS{
275  interface StudyBuilder{
276   exception LockProtection {};
277   void CommitCommand() raises(LockProtection);
278  };
279 };
280 \endverbatim
281
282 could be used caught as
283
284 \verbatim
285 from SALOMEDS import StudyBuilder;
286 my_StudyBuilder=...
287 try:
288   my_StudyBuilder.CommitCommand();
289 except StudyBuilder.LockProtection,value:
290   print "Error! Study is locked for modifications"
291 \endverbatim
292
293
294 \subsection subsection6 Mapping for Enumeration Types
295
296 An enumeration is mapped into a number of constant objects in the name space where
297 the enumeration is defined. An application may only test for equivalence of two
298 enumeration values, and not assume that they behave like numbers.
299 For example, the definition
300
301 \verbatim
302 module VISU {
303  interface PrsObject{
304  
305   enum PrsObjType{ TCURVE, TTABLE, TMESH, TCONTAINER,
306                    TSCALARMAP, TISOSURFACE, TDEFORMEDSHAPE,
307                    TCUTPLANES, TVECTORS };
308  };
309 };
310 \endverbatim
311
312 introduces the objects
313
314 \verbatim
315 from VISU import PrsObject
316 VISU.PrsObjType.TCURVE,VISU.PrsObjType.TTABLE,VISU.PrsObjType.TMESH,VISU.PrsObjType.TCONTAINER,
317 VISU.PrsObjType.TSCALARMAP,VISU.PrsObjType.TISOSURFACE,VISU.PrsObjType.TDEFORMEDSHAPE,VISU.PrsObjType.TCUTPLANES,
318 VISU.PrsObjType.TVECTORS
319 \endverbatim
320
321 \subsection subsection7 Mapping for Structured Types
322
323 An IDL struct definition is mapped into a Python class or type. For each field in the
324 struct, there is a corresponding attribute in the class with the same name as the field.
325 The constructor of the class expects the field values, from left to right.
326 For example, the IDL definition
327
328 \verbatim
329 struct SDate {
330                short Second;
331                short Minute;
332                short Hour;
333                short Day;
334                short Month;
335                short Year;
336              };
337 \endverbatim
338
339 could be used in the Python statements
340
341 \verbatim
342 Date=SDate(30, 12, 15, 26, 1, 79)
343 print Date.Second,Date.Minute,Date.Hour,Date.Day,Date.Month,Date.Year
344 \endverbatim
345 */
346 /*! \page page2 Mapping of SALOME IDL definitions to Python language.
347
348
349   - <B>%SALOME STUDY module</B>
350      - <A href=HTML/SALOMEDS.html>Mapping of %SALOMEDS functions</A>
351      - <A href=HTML/SALOMEDS_Attributes.html>Mapping of SALOMEDS_Attributes functions</A>
352   - <B>%SAlOME KERNEL module</B>
353      - <A href=HTML/Med_Gen.html>Mapping of %Med_Gen functions</A>
354      - <A href=HTML/SALOME_Session.html>Mapping of %SALOME_Session functions</A>
355      - <A href=HTML/SALOME_ModuleCatalog.html>Mapping of %SALOME_ModuleCatalog functions</A>
356      - <A href=HTML/SALOME_Exception.html>Mapping of %SALOME_Exception functions</A>
357      - <A href=HTML/SALOME_Component.html>Mapping of %SALOME_Component functions</A>
358   - <B>%SALOME MED component</B>
359      - <A href=HTML/MED.html>Mapping of %Med functions</A>
360   - <B>%SALOME SUPERVISION module</B>
361      - <A href=HTML/SUPERV.html>Mapping of %SUPERV functions</A>
362   - <B>%SALOME %VISU module</B>
363      - <A href=HTML/VISU_Gen.html>Mapping of %VISU_Gen functions</A>
364
365 */
366
367 /*! \defgroup Study SALOME STUDY module
368 */
369
370 /*!
371   \file SALOMEDS.idl This file contains a set of interfaces used for creation, managment
372   and modification of the %Study
373 */
374
375 #ifndef _SALOMEDS_IDL_
376 #define _SALOMEDS_IDL_
377
378 #include "SALOME_Exception.idl"
379
380 /*! \ingroup Study
381      This package contains the interfaces used for creation, managment
382      and modification of the %Study
383 */
384 module SALOMEDS
385 {
386 /*! \typedef URL
387     Name of the file in which the %Study is saved.
388
389 */
390   typedef string URL;
391
392 /*! Main identifier of an object in %SALOME application
393 */
394   typedef string ID;
395
396 /*! While saving the data, IOR is transformed into persistent reference
397 */
398   typedef string PersistentReference;
399
400 /*! IOR of the study in %SALOME application
401 */
402   typedef string SalomeReference;
403 /*! List of names of open studies in a %SALOME session
404 */
405   typedef sequence<string> ListOfOpenStudies;
406 /*! List of file names
407 */
408   typedef sequence<string> ListOfFileNames;
409 /*! List of modification dates of the study
410 */
411   typedef sequence<string> ListOfDates ;
412 /*! An unbounded sequence of strings
413 */
414   typedef sequence<string> ListOfStrings ;
415 /*! A byte stream which is used for binary data transfer between components
416 */
417   typedef sequence<octet> TMPFile;
418
419   // Reference to other objects is treated with function AddReference
420   // and ReferencedObject
421   // All other type of attributes defined in AttributeType enum are
422   // treated with AddAdttribute and GetAttribute
423   // The difference is made because Reference attribute don't contain
424   // strings but reference to ID of other objects
425
426   interface GenericAttribute;
427   interface Study;
428   interface StudyManager;
429   interface StudyBuilder;
430   interface SObject;
431   interface SComponent;
432   interface SComponentIterator;
433   interface ChildIterator;
434   interface Driver;
435   interface AttributeStudyProperties;
436   interface UseCaseIterator;
437   interface UseCaseBuilder;
438   interface Callback;
439 /*! List of attributes
440 */
441   typedef sequence<GenericAttribute> ListOfAttributes;
442 /*! Exception indicating that this feature hasn't been implemented
443 */
444   exception NotImplemented {};
445
446
447   //===========================================================================
448  /*! \brief %Study Interface
449
450     The purpose of the %Study is to manage the data produced by various components of %SALOME platform.
451    Most of the %Study operations are handled by the StudyManager and the StudyBuilder.
452    What is left in the %Study interface are elementary inquiries.
453    (Incidentally, we recall that a CORBA attribute is implemented as a pair of get
454       and set methods.) A %Study is explored by a set of tools, mainly iterators
455     , which are described further. Nevertheless, the %Study
456      interface allows the search of an object by name or by ID.
457      \note
458      <BR><VAR>The Path </VAR>of an object in %SALOME application is much alike a standard path of a file.
459     In general it's a string of names of directories divided by a slash '/'.
460      <BR><VAR>The Context</VAR> is the current directory of an object.</P>
461 */
462
463   interface Study
464   {
465     exception StudyInvalidContext {};
466     exception StudyInvalidComponent {};
467 /*! Invalid directory of the %study exception
468 */
469     exception StudyInvalidDirectory {};
470 /*! Exception pointing that this name of the study has already been used.
471 */
472     exception StudyNameAlreadyUsed {};
473     exception StudyObjectAlreadyExists {};
474 /*! Invalid name of the %study exception
475 */
476     exception StudyNameError {};
477     exception StudyCommentError {};
478 /*! \brief The name of the %Study
479
480    This is equivalent to the methods setName() & getName()
481 */
482     attribute string     Name; // equivalent to setName() & getName()
483 /*! \brief The ID of the %Study
484
485    This is equivalent to the methods setID() & getID()
486 */
487     attribute short      StudyId;
488 /*! Sequence containing %SObjects
489 */
490     typedef sequence<SObject> ListOfSObject;
491 /*!
492   Gets a persistent reference to the %Study.
493 */
494     PersistentReference  GetPersistentReference();
495 /*!
496   Gets a transient reference to the %Study.
497 */
498     SalomeReference      GetTransientReference();
499
500 /*!
501     Returns True if the %Study is empty
502 */
503     boolean IsEmpty();
504 /*!
505     Allows to find a %SComponent by its name.
506    \param aComponentName    It's a string value in the Comment Attribute of the Component,
507     which is looked for, defining the data type of this Component.
508
509 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
510 */
511     SComponent FindComponent  (in string aComponentName);
512 /*!
513     Allows to find a %SComponent by ID of the according %SObject
514 */
515     SComponent FindComponentID(in ID aComponentID);
516 /*!
517     Allows to find a %SObject by the Name Attribute of this %SObject
518 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
519
520 */
521     SObject       FindObject      (in string anObjectName);
522 /*!
523     Allows to find a %SObject by its ID
524 */
525     SObject       FindObjectID    (in ID aObjectID);
526 /*!
527     Allows to find a %SObject by IOR of the object belonging to this %SObject.
528 */
529     SObject       FindObjectIOR   (in ID aObjectIOR);
530 /*!
531     Returns a list of %SObjects belonging to this %Component. The Name Attribute
532     of these %SObjects should correspond to <VAR>anObjectName</VAR>.
533 */
534     ListOfSObject FindObjectByName(in string anObjectName, in string aComponentName);
535 /*!
536     Allows to find a %SObject by the path to it.
537 */
538     SObject FindObjectByPath(in string thePath);
539 /*!
540     Returns the path to the %SObject.
541 */
542     string  GetObjectPath(in Object theObject);
543
544 /*!
545     Sets the context of the %Study.
546 <BR><VAR>See also <A href=exemple/Example23.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
547
548 */
549     void SetContext(in string thePath);
550 /*!
551     Gets the context of the %Study
552 <BR><VAR>See also <A href=exemple/Example23.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
553
554 */
555     string GetContext();
556 /*!
557    Returns a list of names of objects corresponding to the context.
558    \note  If the parameter <VAR>theContext</VAR> is empty, then the current context will be used.
559 */
560     ListOfStrings GetObjectNames(in string theContext);
561 /*!
562    Returns a list of names of directories and subdirectories corresponding to the context.
563    \note  If the parameter <VAR>theContext</VAR> is empty, then the current context will be used.
564 */
565     ListOfStrings GetDirectoryNames(in string theContext);
566 /*!
567    Returns a list of names of Files corresponding to the context.
568     \note  If the parameter <VAR>theContext</VAR> is empty, then the current context will be used.
569 */
570     ListOfStrings GetFileNames(in string theContext);
571 /*!
572    Returns a list of names of Components corresponding to the context.
573    \note  If the parameter <VAR>theContext</VAR> is empty, then the current context will be used.
574 */
575     ListOfStrings GetComponentNames(in string theContext);
576 /*! \brief Creation of a new iterator of child levels
577
578     Creates a new iterator of child levels of the %SObject
579 */
580     ChildIterator      NewChildIterator(in SObject aSO);
581 /*! \brief Creation of a new iterator of the %SComponent
582
583     Creates a new iterator of the %SComponent.
584 */
585     SComponentIterator NewComponentIterator();
586 /*! \brief Creation of a %StudyBuilder
587
588    Creates a new %StudyBuilder to add or modify an object in the study.
589 <BR><VAR>See also <A href=exemple/Example20.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
590
591 */
592     StudyBuilder NewBuilder() ;
593 /*! \brief Labels dependency
594
595     Updates the map with IOR attribute. It's an inner method used for optimization.
596 */
597     void UpdateIORLabelMap(in string anIOR, in string anEntry);
598
599 /*! \brief Getting properties of the study
600
601    Returns the attriubte, which contains the properties of this study.
602 <BR><VAR>See also <A href=exemple/Example20.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
603
604 */
605     AttributeStudyProperties GetProperties();
606 /*!
607    Determines whether the %study has been saved
608 */
609     attribute boolean IsSaved;
610 /*!
611   Returns True if the %study has been modified and not saved.
612 */
613     boolean IsModified();
614 /*!
615    Determines the file where the %study has been saved
616 */
617     attribute string  URL;
618
619 /*! \brief List of %SObjects
620
621     Returns the list of %SObjects which refers to %anObject.
622 */
623     ListOfSObject FindDependances(in SObject anObject);
624
625 /*! \brief The date of the last saving of the study
626
627     Returns the date of the last saving of study with format: "DD/MM/YYYY HH:MM"
628 */
629     string GetLastModificationDate();
630 /*! \brief The list of modification dates of the study
631
632     Returns the list of modification dates (without creation date) with format "DD/MM/YYYY HH:MM".
633       Note : the first modification begins the list.
634 */
635     ListOfDates GetModificationsDate();
636 /*! \brief Object conversion.
637
638     Converts an object into IOR.
639     \return    IOR
640 */
641     string ConvertObjectToIOR(in Object theObject);
642 /*! \brief Object conversion.
643
644     Converts IOR into an object.
645     \return    An object
646 */
647     Object ConvertIORToObject(in string theIOR);
648 /*!
649     Gets a new %UseCaseBuilder.
650 */
651     UseCaseBuilder  GetUseCaseBuilder();
652
653 /*!
654     Closes the components in the study, removes itself from the %StudyManager.
655 */
656     void Close();
657
658 /*!
659     Enables(if isEnabled = True)/disables automatic addition of new %SObjects to the use case.
660 */
661     void EnableUseCaseAutoFilling(in boolean isEnabled);
662   };
663
664   //==========================================================================
665 /*! \brief %Study Builder Interface
666
667   The purpose of the Builder is to add and/or remove objects and attributes.
668   A %StudyBuilder is linked to a %Study. A
669   command management is provided for the undo/redo functionalities.
670   \note
671   <BR><VAR>The Tag</VAR> of an item in %SALOME application is a symbolic description of
672   item's position in the tree-type structure of the browser. In general it has the following
673   form: <TT>0:2:1:1</TT>
674 */
675   //==========================================================================
676
677   interface StudyBuilder
678   {
679 /*! \brief %LockProtection Exception
680
681     This exception is raised while attempting to modify a locked %study.
682 */
683     exception LockProtection {};
684 /*! \brief Creation of a new %SComponent.
685
686    Creates a new %SComponent
687    \param ComponentDataType    Data type of the %SComponent which will be created.
688
689 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
690
691 */
692     SComponent NewComponent(in string ComponentDataType);
693 /*! \brief Definition of the instance to the %SComponent
694
695     Defines the instance to the %SComponent.
696 */
697     void       DefineComponentInstance (in SComponent aComponent,in Object ComponentIOR);
698 /*! \brief Deletion of the %SComponent
699
700   Removes the %SComponent.
701 */
702     void       RemoveComponent(in SComponent aComponent);
703
704 /*! \brief Creation of a new %SObject
705
706    Creates a new %SObject.
707 <BR><VAR>See also <A href=exemple/Example18.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
708
709 */
710     SObject NewObject      (in SObject theFatherObject);
711 /*! \brief Creation of a new %SObject with a definite %tag
712
713    Creates a new %SObject with a definite %tag.
714 */
715     SObject NewObjectToTag (in SObject theFatherObject, in long atag);
716 /*! \brief Deletion of the %SObject
717
718   Removes a %SObject from the %StudyBuilder.
719 */
720     void    RemoveObject   (in SObject anObject);
721 /*! \brief Deletion of the %SObject with all his child objects.
722
723   Removes the %SObject with all his child objects.
724 */
725     void    RemoveObjectWithChildren(in SObject anObject);
726
727 /*!
728    Loads a %SComponent.
729 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
730
731 */
732     void  LoadWith (in SComponent sco, in Driver Engine) raises (SALOME::SALOME_Exception);
733 /*!
734    Loads a %SObject.
735 */
736     void  Load (in SObject sco);
737
738 /*! \brief Looking for or creating an attribute assigned to the %SObject
739
740     Allows to find or create an attribute of a specific type which is assigned to the object.
741     \param anObject        The %SObject corresponding to the attribute which is looked for.
742     \param aTypeOfAttribute     Type of the attribute.
743
744   <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
745 */
746
747     GenericAttribute FindOrCreateAttribute(in  SObject        anObject,
748                                          in  string         aTypeOfAttribute);
749
750 /*! \brief Looking for an attribute assigned to %SObject
751
752     Allows to find an attribute of a specific type which is assigned to the object.
753     \param anObject        The %SObject corresponding to the attribute which is looked for.
754     \param aTypeOfAttribute     Type of the attribute.
755     \param anAttribute       Where the attribute is placed if it's found.
756     \return True if it finds an attribute.
757  */
758
759     boolean FindAttribute(in  SObject        anObject,
760                                  out GenericAttribute anAttribute,
761                                  in  string         aTypeOfAttribute);
762 /*! \brief Deleting the attribute assigned to the %SObject
763
764     Removes the attribute of a specific type which is assigned to the object.
765     \param anObject        The %SObject corresponding to the attribute.
766     \param aTypeOfAttribute     Type of the attribute.
767
768 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
769 */
770     void RemoveAttribute(in  SObject        anObject,
771                                 in  string         aTypeOfAttribute);
772 /*! \brief Addition of a reference
773
774     Adds a reference between %anObject and %theReferencedObject.
775 */
776
777     void Addreference(in SObject anObject,
778                       in SObject theReferencedObject) ;
779 /*!
780    Adds a directory in the %Study.
781 <BR><VAR>See also <A href=exemple/Example23.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
782
783 */
784     void AddDirectory(in string theName);
785
786 /*! \brief Identification of the %SObject's substructure.
787
788       Identification of the %SObject's substructure by GUID.
789       It has the following format "00000000-0000-0000-0000-000000000000"
790 */
791
792      void SetGUID(in SObject anObject, in string theGUID);
793 /*!
794
795    Returns True if the %SObject has GUID.
796 */
797      boolean IsGUID(in SObject anObject, in string theGUID);
798
799 /*! \brief Creation of a new command
800
801    Creates a new command which can contain several different actions.
802 <BR><VAR>See also <A href=exemple/Example3.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
803
804 */
805     void NewCommand(); // command management
806 /*! \brief Execution of the command
807
808    Commits all actions declared within this command.
809 <BR><VAR>See also <A href=exemple/Example16.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
810
811 */
812     void CommitCommand() raises(LockProtection); // command management
813 /*!
814     Returns True if at this moment there is a command under execution.
815 */
816     boolean HasOpenCommand();
817 /*! \brief Cancelation of the command
818
819     Cancels all actions declared within the command.
820 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
821 */
822     void AbortCommand(); // command management
823 /*! \brief Undolimit
824
825     The number of actions which can be undone
826 */
827     attribute long  UndoLimit;
828 /*! \brief Undo method
829
830     Cancels all actions of the last command.
831 <BR><VAR>See also <A href=exemple/Example16.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
832
833 */
834     void Undo() raises (LockProtection);
835 /*! \brief Redo method
836
837     Redoes all actions of the last command.
838  <BR><VAR>See also <A href=exemple/Example16.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
839
840 */
841     void Redo() raises (LockProtection);
842 /*!
843     Returns True if at this moment there are any actions which can be canceled.
844    <BR><VAR>See also <A href=exemple/Example16.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
845
846 */
847     boolean GetAvailableUndos();
848 /*!
849     Returns True if at this moment there are any actions which can be redone.
850    <BR><VAR>See also <A href=exemple/Example3.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
851
852 */
853     boolean GetAvailableRedos();
854 /*!
855     Sets the callback for addition of the given %SObject. Returns the previous callback.
856 */
857     Callback SetOnAddSObject(in Callback theCallback);
858 /*!
859     Sets the callback for removal of the given %SObject. Returns the previous callback.
860 */
861     Callback SetOnRemoveSObject(in Callback theCallback);
862
863   };
864
865   //==========================================================================
866 /*! \brief %Study Manager interface
867
868     The purpose of the Manager is to manipulate the %Studies. You will find in this
869     interface the methods to create, open,
870     close, and save a %Study. Since a %SALOME session is multi-document, you will
871     also find the methods allowing to navigate
872     through the collection of studies present in a session.
873 */
874   //==========================================================================
875
876   interface StudyManager
877   {
878 /*!
879     Determines whether the server has already been loaded or not.
880 */
881     void ping();
882
883 /*! \brief Creation of a new %Study
884
885      Creates a new %Study with a definite name.
886 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
887
888 */
889     Study NewStudy(in string study_name);
890
891 /*! \brief Open a study
892
893      Reads and activates the structure of the study %Objects.
894     \warning This method doesn't activate the corba objects. Only a component can do it.
895 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
896 */
897     Study Open (in URL aStudyUrl) raises (SALOME::SALOME_Exception);
898
899 /*! \brief Closing the study
900
901     Closes the study.
902 */
903     void  Close(in Study aStudy);
904 /*! \brief Saving the study
905
906     Saves the study.
907 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
908
909 */
910     void  Save(in  Study aStudy, in boolean theMultiFile);
911
912     void  SaveASCII(in  Study aStudy, in boolean theMultiFile);
913 /*! \brief Saving the study in a file
914
915     Saves the study in a specified file.
916  <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
917 */
918     void  SaveAs(in URL   aUrl, // if the file already exists
919                 in Study aStudy,
920                 in boolean theMultiFile); // overwrite (as option)
921
922     void  SaveAsASCII(in URL   aUrl, // if the file already exists
923                       in Study aStudy,
924                       in boolean theMultiFile); // overwrite (as option)
925
926
927 /*! \brief List of open studies.
928
929     Returns the list of open studies in the current session.
930 */
931     ListOfOpenStudies GetOpenStudies();
932
933 /*! \brief Getting a particular %Study picked by name
934
935     Activates a particular %Study
936     amongst the session collection picking it by name.
937 */
938     Study GetStudyByName  (in string aStudyName);
939
940 /*! \brief Getting a particular %Study picked by ID
941
942     Activates a particular %Study
943     amongst the session collection picking it by ID.
944 */
945     Study GetStudyByID  (in short aStudyID);
946
947     // copy/paste methods
948
949 /*!
950     Returns True, if the given %SObject can be copied to the clipboard.
951 */
952     boolean CanCopy(in SObject theObject);
953 /*!
954     Returns True, if the given %SObject is copied to the clipboard.
955 */
956     boolean Copy(in SObject theObject);
957 /*!
958     Returns True, if the object from the clipboard can be pasted to the given %SObject.
959 */
960     boolean CanPaste(in SObject theObject);
961 /*!
962     Returns the %SObject in which the object from the clipboard was pasted to.
963 */
964     SObject Paste(in SObject theObject) raises (SALOMEDS::StudyBuilder::LockProtection);
965   };
966
967
968   //==========================================================================
969 /*! \brief %SObject interface
970
971    The objects in the %study are built by the %StudyBuilder. The %SObject interface
972    provides methods for elementary inquiries, like getting an object %ID or its attribuites.
973  \note
974    <BR><VAR>Tag</VAR> of an item in %SALOME application is an integer value uniquely defining an item
975    in the tree-type data structure.
976    <BR><VAR>ID</VAR> of an item is a description of item's position in the tree-type data structure.
977    ID is a list of tags and it has the following form: <TT>0:2:1:1</TT>.
978 */
979   //==========================================================================
980
981   interface SObject
982   {
983 /*! Name of the %SObject
984 */
985     attribute string Name; // equivalent to setName() & getName()
986 /*! \brief Getting an object %ID
987
988    Returns ID of the %SObject.
989 */
990     ID GetID();
991 /*! \brief Acquisition of the father %Component of the %SObject
992
993   Returns the father %Component of the %SObject.
994 */
995     SComponent GetFatherComponent();
996 /*! \brief Acquisition of the father %SObject of the %SObject
997
998    Returns the father %SObject of the given %SObject.
999 */
1000     SObject    GetFather();
1001 /*! \brief %Tag of %SObject
1002
1003     Returns the %tag of the %SObject.
1004 */
1005     short      Tag();
1006 /*! \brief Looking for subobjects of an object.
1007
1008     Returns True if it finds a subobject of the %SObject with a definite tag.
1009 */
1010
1011     boolean FindSubObject (in long atag, out SObject obj);
1012 /*! \brief Looking for attributes of the %SObject
1013
1014    Returns True if it finds an attribute of a definite type of the %SObject.
1015 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
1016 */
1017     boolean FindAttribute(out GenericAttribute anAttribute,
1018                                   in  string         aTypeOfAttribute);
1019 /*!
1020     Returns the object which this %SObject refers to. It also returns True if it finds
1021     this object.
1022 */
1023     boolean ReferencedObject(out SObject obj); // A REVOIR
1024 /*! \brief Getting all attributes of the %SObject
1025
1026     Returns the list of all attributes of the %SObject.
1027 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
1028
1029 */
1030     ListOfAttributes     GetAllAttributes();
1031 /*! \brief Returning the study
1032
1033     Returns the study containing the given %SObject.
1034 */
1035     Study GetStudy();
1036   };
1037
1038
1039   //==========================================================================
1040 /*! \brief %Generic attribute interface
1041
1042    %Generic attribute is a base interface for all attributes which inherit
1043    its methods.
1044 */
1045   //==========================================================================
1046   interface GenericAttribute
1047   {
1048 /*! \brief Exception locking all changes
1049
1050     This exception locks all modifications in attributes.
1051 */
1052     exception LockProtection {};
1053 /*! \brief Method CheckLocked
1054
1055    Checks whether the %Study is protected for modifications.
1056    \note <BR>This exception is raised only outside the transaction.
1057 */
1058     void CheckLocked() raises (LockProtection);
1059   };
1060
1061
1062
1063   //==========================================================================
1064 /*! \brief %SComponent interface
1065
1066    The %SComponent interface is a specialization of the %SObject interface.
1067    It inherits the most of its methods from the %SObject interface.
1068 */
1069   //==========================================================================
1070   interface SComponent : SObject
1071   {
1072 /*! \brief Data type of the %SComponent
1073
1074     Returns the data type of the %SComponent.
1075 */
1076     string  ComponentDataType();
1077 /*!
1078   Returns IOR of the according component.
1079 */
1080     boolean ComponentIOR (out ID theID); //returns True if there is an instance
1081                                          //In this case ID identifies this one
1082   };
1083
1084
1085   //==========================================================================
1086 /*! \brief %SComponentIterator interface
1087
1088   This interface contains the methods allowing to iterate over all components in the list.
1089   The search is started from the first %SComponent in the list.
1090 */
1091   //==========================================================================
1092   interface SComponentIterator
1093   {
1094 /*! \brief Initialization of the Iterator
1095
1096 Activates the %SComponentIterator.
1097 */
1098     void Init();
1099 /*! \brief Method More
1100
1101    Returns True if there is one more %SComponent in the list.
1102 */
1103     boolean More();
1104 /*! \brief Moving the iterator to the next %SComponent
1105
1106 Moves the iterator to the next %SComponent in the list.
1107 */
1108     void Next();
1109 /*!
1110     Returns the %SComponent corresponding to the current %SComponent found by the iterator.
1111  <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
1112
1113 */
1114     SComponent Value();
1115   };
1116
1117   //==========================================================================
1118 /*! \brief %ChildIterator interface
1119
1120     This interface contains methods which allow to iterate over all child
1121     levels.
1122 */
1123   //==========================================================================
1124   interface ChildIterator
1125   {
1126 /*! \brief Initialization of the Iterator.
1127
1128 Activates the %ChildIterator.
1129 */
1130     void Init();
1131 /*! \brief Initialization of the Iterator for all child levels.
1132
1133 Activates the %ChildIterator (if True) for all child levels.
1134 */
1135     void InitEx(in boolean allLevels);
1136 /*! \brief Method More
1137
1138     Returns True if the %ChildIterator finds one more child level.
1139 */
1140     boolean More();
1141 /*!
1142     Passes the iterator to the next level.
1143 */
1144     void Next();
1145 /*!
1146     Returns the %SObject corresponding to the current object found by the iterator.
1147 */
1148     SObject Value();
1149   };
1150
1151   //==========================================================================
1152   //==========================================================================
1153 /*! \brief Interface of the %UseCaseIterator.
1154
1155    This interface contains a set of methods used for iteration over the objects in the use case.
1156 */
1157   interface UseCaseIterator
1158   {
1159 /*! \brief Initialization of the Iterator.
1160
1161 Activates the %UseCaseIterator. If <VAR>allLevels</VAR> is True the Iterator is activated for all subobjects.
1162 */
1163     void Init(in boolean allLevels);
1164 /*! \brief Method More
1165
1166     Returns True if the %UseCaseIterator finds one more object.
1167 */
1168     boolean More();
1169 /*!
1170     Passes the iterator to the next object.
1171 */
1172     void Next();
1173 /*!
1174     Returns the %SObject corresponding to the current object found by the Iterator.
1175 */
1176     SObject Value();
1177   };
1178
1179   //==========================================================================
1180   //==========================================================================
1181 /*! \brief Interface of the %UseCaseBuilder
1182
1183    Use case in the study represents a user-managed subtree, containing all or some of the objects which exist in the study.
1184    The %UseCaseBuilder interface contains a set of methods used for management of the use case in the study.
1185 */
1186   interface UseCaseBuilder
1187   {
1188 /*!
1189    Adds to the use case an object <VAR>theObject</VAR> as a child of the current object of the use case.
1190 */
1191     boolean Append(in SObject theObject);
1192 /*!
1193    Removes an object <VAR>theObject</VAR> from the use case.
1194 */
1195     boolean Remove(in SObject theObject);
1196 /*!
1197    Adds a child object <VAR>theObject</VAR> to the given father <VAR>theFather</VAR> object in the use case.
1198 */
1199     boolean AppendTo(in SObject theFather, in SObject theObject);
1200 /*!
1201     Inserts in the use case the object <VAR>theFirst</VAR> before the object <VAR>theNext</VAR>.
1202 */
1203     boolean InsertBefore(in SObject theFirst, in SObject theNext);
1204 /*!
1205     Sets the current object of the use case.
1206 */
1207     boolean SetCurrentObject(in SObject theObject);
1208 /*!
1209     Makes the root object to be the current object of the use case.
1210 */
1211     boolean SetRootCurrent();
1212 /*!
1213    Returns True if the given object <VAR>theObject</VAR> of the use case has child objects.
1214 */
1215     boolean HasChildren(in SObject theObject);
1216 /*!
1217    Sets the name of the use case.
1218 */
1219     boolean SetName(in string theName);
1220 /*!
1221    Gets the name of the use case.
1222 */
1223     string GetName();
1224 /*!
1225    Returns True if the given object <VAR>theObject</VAR> represents a use case.
1226 */
1227     boolean IsUseCase(in SObject theObject);
1228 /*!
1229     Gets the current object of the use case.
1230 */
1231     SObject GetCurrentObject();
1232 /*!
1233     Creates a new use case in the use case browser.
1234 */
1235     SObject AddUseCase(in string theName);
1236 /*!
1237     Returns the %UseCaseIterator for the given object <VAR>theObject</VAR> in the use case.
1238 */
1239     UseCaseIterator GetUseCaseIterator(in SObject theObject);
1240   };
1241   //==========================================================================
1242   //==========================================================================
1243 /*! \brief The callback interface  
1244
1245   The %StudyBuilder can be created with the method <VAR>NewBuilder</VAR>. While invocation of this method a new object of the class <VAR>Callback</VAR> is created
1246   and this object is assigned to the newly created Builder as callback which should be called when adding and removing of the ojects.
1247 */
1248   interface Callback
1249   {
1250 /*!
1251      Invokes the corresponding method <VAR>Append</VAR> of the %UseCaseBuilder.
1252 */
1253      void OnAddSObject(in SObject theObject);
1254 /*!
1255      Invokes the corresponding method <VAR>Remove</VAR> of the %UseCaseBuilder.
1256 */
1257      void OnRemoveSObject(in SObject theObject);
1258   };
1259
1260   //==========================================================================
1261 /*! \brief %Driver interface
1262
1263     This interface contains a set of methods used for the management
1264      of the object produced in the %study by a component.
1265 */
1266   //==========================================================================
1267   interface Driver
1268   {
1269
1270     /*! \brief Saving the data.
1271
1272         This method is called by the StudyManager when saving a study.
1273        \param theComponent    %SComponent corresponding to this Component
1274        \return A byte stream TMPFile that contains all saved data
1275
1276 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
1277
1278      */
1279
1280
1281     TMPFile Save(in SComponent theComponent, in string theURL, in boolean isMultiFile);
1282
1283     TMPFile SaveASCII(in SComponent theComponent, in string theURL, in boolean isMultiFile);
1284
1285     /*! \brief Loading the data.
1286
1287        This method is called by the StudyManager when opening a study.
1288        \param theComponent      %SComponent corresponding to this Component
1289        \param theStream   The file which contains all data saved by the component on Save method
1290      */
1291
1292     boolean Load(in SComponent theComponent, in TMPFile theStream, in string theURL, in boolean isMultiFile);
1293
1294     boolean LoadASCII(in SComponent theComponent, in TMPFile theStream, in string theURL, in boolean isMultiFile);
1295
1296     /*! \brief Closing of the study
1297
1298       This method Close is called by the StudyManager when closing a study.
1299
1300      */
1301
1302     void Close (in SComponent aSComponent);
1303     //void Close ( in string  aIORSComponent);
1304
1305     /*! \brief The type of the data
1306
1307         Returns the type of data produced by the Component in the study.
1308      */
1309
1310      string ComponentDataType();
1311
1312     // Driver Transient -> persistent called for each object in study
1313 /*!
1314    Transforms IOR into PersistentID of the object. It is called for each
1315    object in the %study.
1316 */
1317     string IORToLocalPersistentID (in SObject theSObject,
1318                                    in string IORString,
1319                                    in boolean isMultiFile,
1320                                    in boolean isASCII);
1321 /*!
1322   Transforms PersistentID into IOR of the object. It is called for each
1323    object in the %study.
1324 */
1325     string LocalPersistentIDToIOR (in SObject theSObject,
1326                                    in string aLocalPersistentID,
1327                                    in boolean isMultiFile,
1328                                    in boolean isASCII)
1329       raises (SALOME::SALOME_Exception);
1330
1331     // Publishing in the study
1332 /*! \brief Publishing in the study
1333
1334     Returns True if the given %Component can publish the %object in the %study.
1335 */
1336     boolean CanPublishInStudy(in Object theIOR) raises (SALOME::SALOME_Exception);
1337 /*! \brief Publishing in the study
1338
1339    Publishes the given object in the %study, using the algorithm of this component.
1340     \param theStudy     The %study in which the object is published
1341     \param theSObject     If this parameter is null the object is published for the first time. Otherwise
1342     this parameter should contain a reference to the object published earlier
1343     \param theObject      The object which is published
1344     \param theName      The name of the published object. If this parameter is empty, the name is generated
1345     automatically by the component.
1346 */
1347     SObject PublishInStudy(in Study theStudy, in SObject theSObject, in Object theObject, in string theName);
1348
1349     // copy/paste methods
1350
1351 /*!
1352     Returns True, if the given %SObject can be copied to the clipboard.
1353 */
1354     boolean CanCopy(in SObject theObject);
1355 /*!
1356     Returns the object %ID and the %TMPFile of the object from the given %SObject.
1357 */
1358     TMPFile CopyFrom(in SObject theObject, out long theObjectID);
1359 /*!
1360     Returns True, if the component can paste the object with given %ID of the component with name <VAR>theComponentName</VAR>.
1361 */
1362     boolean CanPaste(in string theComponentName, in long theObjectID);
1363 /*!
1364     Returns the %SObject of the pasted object.
1365 */
1366     SObject PasteInto(in TMPFile theStream, in long theObjectID, in SObject theObject);
1367
1368   };
1369 };
1370  
1371 #endif