1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
18 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
22 // File : SALOMEDS.idl
23 // Author : Yves FRICAUD
27 \image html Application-About.png
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.
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.
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>
45 <BR><STRONG>CONTENTS:</STRONG>
54 \subsection subsection1 Using Scoped Names
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.
60 Because of these constraints, scoped names are translated into Python using the
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.
71 \95 For all other scopes, a Python class is introduced that contains all the definitions
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.
82 interface StudyManager {
83 void Close(in Study aStudy);
88 would introduce a module SALOMEDS.py, which contains the following definitions:
93 def _Close(self,aStudy):
94 pass #interfaces are discussed later
97 To avoid conflicts, IDL names that are also Python identifiers are prefixed with an underscore (
\91_
\92).
99 \subsection subsection2 Mapping for Template and Array Types
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:
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.
108 \95 len(X) returns the number of characters of wide string X.
110 \95 CORBA.wstr(c) returns a wide character with the code point c in an
111 implementation-defined encoding.
113 \95 X+Y returns the concatenation of wide strings X and Y.
115 \95 CORBA.word(CORBA.wstr(c)) == c
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.
121 For example, given the IDL definitions
125 typedef sequence <string> StringSeq;
127 interface AttributeTableOfInteger : GenericAttribute {
129 void SetRowTitles(in StringSeq theTitles) raises(IncorrectArgumentLength);
134 a client could invoke the operation
137 print My_AttributeTableOfInteger.SetRowTitles(["X","F"])
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.
144 Another example with arrays. The following IDL definition
148 typedef sequence<GenericAttribute> ListOfAttributes;
150 ListOfAttributes GetAllAttributes();
162 attributes = My_SObject.GetAllAttributes()
164 length = len(attributes)
166 print "Attributes number = ", length
170 \subsection subsection3 Mapping for Objects and Operations
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.
177 The nil object is represented by <STRONG>None</STRONG>.
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.
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.
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>:
196 \95 If there is no <VAR>result value</VAR>, the method returns None.
198 \95 If there is exactly one <VAR>result value</VAR>, it is returned as a single value.
200 \95 If there is more than one <VAR>result value</VAR>, all of them are packed into a tuple, and this
203 Assuming the IDL definition
207 interface StudyBuilder{
208 boolean FindAttribute ( in SObject anObject,
209 out GenericAttribute anAttribute,
210 in string aTypeOfAttribute );
218 from SALOMEDS import StudyBuilder;
221 res,A=my_StudyBuilder.FindAttribute(Sobj, "AttributeSequenceOfReal")
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.
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>.
236 attribute string Name;
241 is equal to the following
244 from SALOMEDS import Study
246 Name=My_Study._get_name();
247 Name=My_Study._set_name();
250 \subsection subsection4 Narrowing Object References
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.
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
261 A = A._narrow(SALOMEDS.AttributeSequenceOfReal)
264 \subsection subsection5 Mapping for Exceptions
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
275 interface StudyBuilder{
276 exception LockProtection {};
277 void CommitCommand() raises(LockProtection);
282 could be used caught as
285 from SALOMEDS import StudyBuilder;
288 my_StudyBuilder.CommitCommand();
289 except StudyBuilder.LockProtection,value:
290 print "Error! Study is locked for modifications"
294 \subsection subsection6 Mapping for Enumeration Types
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
305 enum PrsObjType{ TCURVE, TTABLE, TMESH, TCONTAINER,
306 TSCALARMAP, TISOSURFACE, TDEFORMEDSHAPE,
307 TCUTPLANES, TVECTORS };
312 introduces the objects
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
321 \subsection subsection7 Mapping for Structured Types
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
339 could be used in the Python statements
342 Date=SDate(30, 12, 15, 26, 1, 79)
343 print Date.Second,Date.Minute,Date.Hour,Date.Day,Date.Month,Date.Year
346 /*! \page page2 Mapping of SALOME IDL definitions to Python language.
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>
367 /*! \defgroup Study SALOME STUDY module
371 \file SALOMEDS.idl This file contains a set of interfaces used for creation, managment
372 and modification of the %Study
375 #ifndef _SALOMEDS_IDL_
376 #define _SALOMEDS_IDL_
378 #include "SALOME_Exception.idl"
381 This package contains the interfaces used for creation, managment
382 and modification of the %Study
387 Name of the file in which the %Study is saved.
392 /*! Main identifier of an object in %SALOME application
396 /*! While saving the data, IOR is transformed into persistent reference
398 typedef string PersistentReference;
400 /*! IOR of the study in %SALOME application
402 typedef string SalomeReference;
403 /*! List of names of open studies in a %SALOME session
405 typedef sequence<string> ListOfOpenStudies;
406 /*! List of file names
408 typedef sequence<string> ListOfFileNames;
409 /*! List of modification dates of the study
411 typedef sequence<string> ListOfDates ;
412 /*! An unbounded sequence of strings
414 typedef sequence<string> ListOfStrings ;
415 /*! A byte stream which is used for binary data transfer between components
417 typedef sequence<octet> TMPFile;
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
426 interface GenericAttribute;
428 interface StudyManager;
429 interface StudyBuilder;
431 interface SComponent;
432 interface SComponentIterator;
433 interface ChildIterator;
435 interface AttributeStudyProperties;
436 interface UseCaseIterator;
437 interface UseCaseBuilder;
439 /*! List of attributes
441 typedef sequence<GenericAttribute> ListOfAttributes;
442 /*! Exception indicating that this feature hasn't been implemented
444 exception NotImplemented {};
447 //===========================================================================
448 /*! \brief %Study Interface
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.
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>
465 exception StudyInvalidContext {};
466 exception StudyInvalidComponent {};
467 /*! Invalid directory of the %study exception
469 exception StudyInvalidDirectory {};
470 /*! Exception pointing that this name of the study has already been used.
472 exception StudyNameAlreadyUsed {};
473 exception StudyObjectAlreadyExists {};
474 /*! Invalid name of the %study exception
476 exception StudyNameError {};
477 exception StudyCommentError {};
478 /*! \brief The name of the %Study
480 This is equivalent to the methods setName() & getName()
482 attribute string Name; // equivalent to setName() & getName()
483 /*! \brief The ID of the %Study
485 This is equivalent to the methods setID() & getID()
487 attribute short StudyId;
488 /*! Sequence containing %SObjects
490 typedef sequence<SObject> ListOfSObject;
492 Gets a persistent reference to the %Study.
494 PersistentReference GetPersistentReference();
496 Gets a transient reference to the %Study.
498 SalomeReference GetTransientReference();
501 Returns True if the %Study is empty
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.
509 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
511 SComponent FindComponent (in string aComponentName);
513 Allows to find a %SComponent by ID of the according %SObject
515 SComponent FindComponentID(in ID aComponentID);
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>
521 SObject FindObject (in string anObjectName);
523 Allows to find a %SObject by its ID
525 SObject FindObjectID (in ID aObjectID);
527 Allows to find a %SObject by IOR of the object belonging to this %SObject.
529 SObject FindObjectIOR (in ID aObjectIOR);
531 Returns a list of %SObjects belonging to this %Component. The Name Attribute
532 of these %SObjects should correspond to <VAR>anObjectName</VAR>.
534 ListOfSObject FindObjectByName(in string anObjectName, in string aComponentName);
536 Allows to find a %SObject by the path to it.
538 SObject FindObjectByPath(in string thePath);
540 Returns the path to the %SObject.
542 string GetObjectPath(in Object theObject);
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>
549 void SetContext(in string thePath);
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>
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.
560 ListOfStrings GetObjectNames(in string theContext);
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.
565 ListOfStrings GetDirectoryNames(in string theContext);
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.
570 ListOfStrings GetFileNames(in string theContext);
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.
575 ListOfStrings GetComponentNames(in string theContext);
576 /*! \brief Creation of a new iterator of child levels
578 Creates a new iterator of child levels of the %SObject
580 ChildIterator NewChildIterator(in SObject aSO);
581 /*! \brief Creation of a new iterator of the %SComponent
583 Creates a new iterator of the %SComponent.
585 SComponentIterator NewComponentIterator();
586 /*! \brief Creation of a %StudyBuilder
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>
592 StudyBuilder NewBuilder() ;
593 /*! \brief Labels dependency
595 Updates the map with IOR attribute. It's an inner method used for optimization.
597 void UpdateIORLabelMap(in string anIOR, in string anEntry);
599 /*! \brief Getting properties of the study
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>
605 AttributeStudyProperties GetProperties();
607 Determines whether the %study has been saved
609 attribute boolean IsSaved;
611 Returns True if the %study has been modified and not saved.
613 boolean IsModified();
615 Determines the file where the %study has been saved
617 attribute string URL;
619 /*! \brief List of %SObjects
621 Returns the list of %SObjects which refers to %anObject.
623 ListOfSObject FindDependances(in SObject anObject);
625 /*! \brief The date of the last saving of the study
627 Returns the date of the last saving of study with format: "DD/MM/YYYY HH:MM"
629 string GetLastModificationDate();
630 /*! \brief The list of modification dates of the study
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.
635 ListOfDates GetModificationsDate();
636 /*! \brief Object conversion.
638 Converts an object into IOR.
641 string ConvertObjectToIOR(in Object theObject);
642 /*! \brief Object conversion.
644 Converts IOR into an object.
647 Object ConvertIORToObject(in string theIOR);
649 Gets a new %UseCaseBuilder.
651 UseCaseBuilder GetUseCaseBuilder();
654 Closes the components in the study, removes itself from the %StudyManager.
659 Enables(if isEnabled = True)/disables automatic addition of new %SObjects to the use case.
661 void EnableUseCaseAutoFilling(in boolean isEnabled);
664 //==========================================================================
665 /*! \brief %Study Builder Interface
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.
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>
675 //==========================================================================
677 interface StudyBuilder
679 /*! \brief %LockProtection Exception
681 This exception is raised while attempting to modify a locked %study.
683 exception LockProtection {};
684 /*! \brief Creation of a new %SComponent.
686 Creates a new %SComponent
687 \param ComponentDataType Data type of the %SComponent which will be created.
689 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
692 SComponent NewComponent(in string ComponentDataType);
693 /*! \brief Definition of the instance to the %SComponent
695 Defines the instance to the %SComponent.
697 void DefineComponentInstance (in SComponent aComponent,in Object ComponentIOR);
698 /*! \brief Deletion of the %SComponent
700 Removes the %SComponent.
702 void RemoveComponent(in SComponent aComponent);
704 /*! \brief Creation of a new %SObject
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>
710 SObject NewObject (in SObject theFatherObject);
711 /*! \brief Creation of a new %SObject with a definite %tag
713 Creates a new %SObject with a definite %tag.
715 SObject NewObjectToTag (in SObject theFatherObject, in long atag);
716 /*! \brief Deletion of the %SObject
718 Removes a %SObject from the %StudyBuilder.
720 void RemoveObject (in SObject anObject);
721 /*! \brief Deletion of the %SObject with all his child objects.
723 Removes the %SObject with all his child objects.
725 void RemoveObjectWithChildren(in SObject anObject);
729 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
732 void LoadWith (in SComponent sco, in Driver Engine) raises (SALOME::SALOME_Exception);
736 void Load (in SObject sco);
738 /*! \brief Looking for or creating an attribute assigned to the %SObject
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.
744 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
747 GenericAttribute FindOrCreateAttribute(in SObject anObject,
748 in string aTypeOfAttribute);
750 /*! \brief Looking for an attribute assigned to %SObject
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.
759 boolean FindAttribute(in SObject anObject,
760 out GenericAttribute anAttribute,
761 in string aTypeOfAttribute);
762 /*! \brief Deleting the attribute assigned to the %SObject
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.
768 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
770 void RemoveAttribute(in SObject anObject,
771 in string aTypeOfAttribute);
772 /*! \brief Addition of a reference
774 Adds a reference between %anObject and %theReferencedObject.
777 void Addreference(in SObject anObject,
778 in SObject theReferencedObject) ;
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>
784 void AddDirectory(in string theName);
786 /*! \brief Identification of the %SObject's substructure.
788 Identification of the %SObject's substructure by GUID.
789 It has the following format "00000000-0000-0000-0000-000000000000"
792 void SetGUID(in SObject anObject, in string theGUID);
795 Returns True if the %SObject has GUID.
797 boolean IsGUID(in SObject anObject, in string theGUID);
799 /*! \brief Creation of a new command
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>
805 void NewCommand(); // command management
806 /*! \brief Execution of the command
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>
812 void CommitCommand() raises(LockProtection); // command management
814 Returns True if at this moment there is a command under execution.
816 boolean HasOpenCommand();
817 /*! \brief Cancelation of the command
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>
822 void AbortCommand(); // command management
825 The number of actions which can be undone
827 attribute long UndoLimit;
828 /*! \brief Undo method
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>
834 void Undo() raises (LockProtection);
835 /*! \brief Redo method
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>
841 void Redo() raises (LockProtection);
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>
847 boolean GetAvailableUndos();
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>
853 boolean GetAvailableRedos();
855 Sets the callback for addition of the given %SObject. Returns the previous callback.
857 Callback SetOnAddSObject(in Callback theCallback);
859 Sets the callback for removal of the given %SObject. Returns the previous callback.
861 Callback SetOnRemoveSObject(in Callback theCallback);
865 //==========================================================================
866 /*! \brief %Study Manager interface
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.
874 //==========================================================================
876 interface StudyManager
879 Determines whether the server has already been loaded or not.
883 /*! \brief Creation of a new %Study
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>
889 Study NewStudy(in string study_name);
891 /*! \brief Open a study
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>
897 Study Open (in URL aStudyUrl) raises (SALOME::SALOME_Exception);
899 /*! \brief Closing the study
903 void Close(in Study aStudy);
904 /*! \brief Saving 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>
910 void Save(in Study aStudy, in boolean theMultiFile);
912 void SaveASCII(in Study aStudy, in boolean theMultiFile);
913 /*! \brief Saving the study in a file
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>
918 void SaveAs(in URL aUrl, // if the file already exists
920 in boolean theMultiFile); // overwrite (as option)
922 void SaveAsASCII(in URL aUrl, // if the file already exists
924 in boolean theMultiFile); // overwrite (as option)
927 /*! \brief List of open studies.
929 Returns the list of open studies in the current session.
931 ListOfOpenStudies GetOpenStudies();
933 /*! \brief Getting a particular %Study picked by name
935 Activates a particular %Study
936 amongst the session collection picking it by name.
938 Study GetStudyByName (in string aStudyName);
940 /*! \brief Getting a particular %Study picked by ID
942 Activates a particular %Study
943 amongst the session collection picking it by ID.
945 Study GetStudyByID (in short aStudyID);
947 // copy/paste methods
950 Returns True, if the given %SObject can be copied to the clipboard.
952 boolean CanCopy(in SObject theObject);
954 Returns True, if the given %SObject is copied to the clipboard.
956 boolean Copy(in SObject theObject);
958 Returns True, if the object from the clipboard can be pasted to the given %SObject.
960 boolean CanPaste(in SObject theObject);
962 Returns the %SObject in which the object from the clipboard was pasted to.
964 SObject Paste(in SObject theObject) raises (SALOMEDS::StudyBuilder::LockProtection);
968 //==========================================================================
969 /*! \brief %SObject interface
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.
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>.
979 //==========================================================================
983 /*! Name of the %SObject
985 attribute string Name; // equivalent to setName() & getName()
986 /*! \brief Getting an object %ID
988 Returns ID of the %SObject.
991 /*! \brief Acquisition of the father %Component of the %SObject
993 Returns the father %Component of the %SObject.
995 SComponent GetFatherComponent();
996 /*! \brief Acquisition of the father %SObject of the %SObject
998 Returns the father %SObject of the given %SObject.
1000 SObject GetFather();
1001 /*! \brief %Tag of %SObject
1003 Returns the %tag of the %SObject.
1006 /*! \brief Looking for subobjects of an object.
1008 Returns True if it finds a subobject of the %SObject with a definite tag.
1011 boolean FindSubObject (in long atag, out SObject obj);
1012 /*! \brief Looking for attributes of the %SObject
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>
1017 boolean FindAttribute(out GenericAttribute anAttribute,
1018 in string aTypeOfAttribute);
1020 Returns the object which this %SObject refers to. It also returns True if it finds
1023 boolean ReferencedObject(out SObject obj); // A REVOIR
1024 /*! \brief Getting all attributes of the %SObject
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>
1030 ListOfAttributes GetAllAttributes();
1031 /*! \brief Returning the study
1033 Returns the study containing the given %SObject.
1039 //==========================================================================
1040 /*! \brief %Generic attribute interface
1042 %Generic attribute is a base interface for all attributes which inherit
1045 //==========================================================================
1046 interface GenericAttribute
1048 /*! \brief Exception locking all changes
1050 This exception locks all modifications in attributes.
1052 exception LockProtection {};
1053 /*! \brief Method CheckLocked
1055 Checks whether the %Study is protected for modifications.
1056 \note <BR>This exception is raised only outside the transaction.
1058 void CheckLocked() raises (LockProtection);
1063 //==========================================================================
1064 /*! \brief %SComponent interface
1066 The %SComponent interface is a specialization of the %SObject interface.
1067 It inherits the most of its methods from the %SObject interface.
1069 //==========================================================================
1070 interface SComponent : SObject
1072 /*! \brief Data type of the %SComponent
1074 Returns the data type of the %SComponent.
1076 string ComponentDataType();
1078 Returns IOR of the according component.
1080 boolean ComponentIOR (out ID theID); //returns True if there is an instance
1081 //In this case ID identifies this one
1085 //==========================================================================
1086 /*! \brief %SComponentIterator interface
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.
1091 //==========================================================================
1092 interface SComponentIterator
1094 /*! \brief Initialization of the Iterator
1096 Activates the %SComponentIterator.
1099 /*! \brief Method More
1101 Returns True if there is one more %SComponent in the list.
1104 /*! \brief Moving the iterator to the next %SComponent
1106 Moves the iterator to the next %SComponent in the list.
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>
1117 //==========================================================================
1118 /*! \brief %ChildIterator interface
1120 This interface contains methods which allow to iterate over all child
1123 //==========================================================================
1124 interface ChildIterator
1126 /*! \brief Initialization of the Iterator.
1128 Activates the %ChildIterator.
1131 /*! \brief Initialization of the Iterator for all child levels.
1133 Activates the %ChildIterator (if True) for all child levels.
1135 void InitEx(in boolean allLevels);
1136 /*! \brief Method More
1138 Returns True if the %ChildIterator finds one more child level.
1142 Passes the iterator to the next level.
1146 Returns the %SObject corresponding to the current object found by the iterator.
1151 //==========================================================================
1152 //==========================================================================
1153 /*! \brief Interface of the %UseCaseIterator.
1155 This interface contains a set of methods used for iteration over the objects in the use case.
1157 interface UseCaseIterator
1159 /*! \brief Initialization of the Iterator.
1161 Activates the %UseCaseIterator. If <VAR>allLevels</VAR> is True the Iterator is activated for all subobjects.
1163 void Init(in boolean allLevels);
1164 /*! \brief Method More
1166 Returns True if the %UseCaseIterator finds one more object.
1170 Passes the iterator to the next object.
1174 Returns the %SObject corresponding to the current object found by the Iterator.
1179 //==========================================================================
1180 //==========================================================================
1181 /*! \brief Interface of the %UseCaseBuilder
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.
1186 interface UseCaseBuilder
1189 Adds to the use case an object <VAR>theObject</VAR> as a child of the current object of the use case.
1191 boolean Append(in SObject theObject);
1193 Removes an object <VAR>theObject</VAR> from the use case.
1195 boolean Remove(in SObject theObject);
1197 Adds a child object <VAR>theObject</VAR> to the given father <VAR>theFather</VAR> object in the use case.
1199 boolean AppendTo(in SObject theFather, in SObject theObject);
1201 Inserts in the use case the object <VAR>theFirst</VAR> before the object <VAR>theNext</VAR>.
1203 boolean InsertBefore(in SObject theFirst, in SObject theNext);
1205 Sets the current object of the use case.
1207 boolean SetCurrentObject(in SObject theObject);
1209 Makes the root object to be the current object of the use case.
1211 boolean SetRootCurrent();
1213 Returns True if the given object <VAR>theObject</VAR> of the use case has child objects.
1215 boolean HasChildren(in SObject theObject);
1217 Sets the name of the use case.
1219 boolean SetName(in string theName);
1221 Gets the name of the use case.
1225 Returns True if the given object <VAR>theObject</VAR> represents a use case.
1227 boolean IsUseCase(in SObject theObject);
1229 Gets the current object of the use case.
1231 SObject GetCurrentObject();
1233 Creates a new use case in the use case browser.
1235 SObject AddUseCase(in string theName);
1237 Returns the %UseCaseIterator for the given object <VAR>theObject</VAR> in the use case.
1239 UseCaseIterator GetUseCaseIterator(in SObject theObject);
1241 //==========================================================================
1242 //==========================================================================
1243 /*! \brief The callback interface
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.
1251 Invokes the corresponding method <VAR>Append</VAR> of the %UseCaseBuilder.
1253 void OnAddSObject(in SObject theObject);
1255 Invokes the corresponding method <VAR>Remove</VAR> of the %UseCaseBuilder.
1257 void OnRemoveSObject(in SObject theObject);
1260 //==========================================================================
1261 /*! \brief %Driver interface
1263 This interface contains a set of methods used for the management
1264 of the object produced in the %study by a component.
1266 //==========================================================================
1270 /*! \brief Saving the data.
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
1276 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
1281 TMPFile Save(in SComponent theComponent, in string theURL, in boolean isMultiFile);
1283 TMPFile SaveASCII(in SComponent theComponent, in string theURL, in boolean isMultiFile);
1285 /*! \brief Loading the data.
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
1292 boolean Load(in SComponent theComponent, in TMPFile theStream, in string theURL, in boolean isMultiFile);
1294 boolean LoadASCII(in SComponent theComponent, in TMPFile theStream, in string theURL, in boolean isMultiFile);
1296 /*! \brief Closing of the study
1298 This method Close is called by the StudyManager when closing a study.
1302 void Close (in SComponent aSComponent);
1303 //void Close ( in string aIORSComponent);
1305 /*! \brief The type of the data
1307 Returns the type of data produced by the Component in the study.
1310 string ComponentDataType();
1312 // Driver Transient -> persistent called for each object in study
1314 Transforms IOR into PersistentID of the object. It is called for each
1315 object in the %study.
1317 string IORToLocalPersistentID (in SObject theSObject,
1318 in string IORString,
1319 in boolean isMultiFile,
1320 in boolean isASCII);
1322 Transforms PersistentID into IOR of the object. It is called for each
1323 object in the %study.
1325 string LocalPersistentIDToIOR (in SObject theSObject,
1326 in string aLocalPersistentID,
1327 in boolean isMultiFile,
1329 raises (SALOME::SALOME_Exception);
1331 // Publishing in the study
1332 /*! \brief Publishing in the study
1334 Returns True if the given %Component can publish the %object in the %study.
1336 boolean CanPublishInStudy(in Object theIOR) raises (SALOME::SALOME_Exception);
1337 /*! \brief Publishing in the study
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.
1347 SObject PublishInStudy(in Study theStudy, in SObject theSObject, in Object theObject, in string theName);
1349 // copy/paste methods
1352 Returns True, if the given %SObject can be copied to the clipboard.
1354 boolean CanCopy(in SObject theObject);
1356 Returns the object %ID and the %TMPFile of the object from the given %SObject.
1358 TMPFile CopyFrom(in SObject theObject, out long theObjectID);
1360 Returns True, if the component can paste the object with given %ID of the component with name <VAR>theComponentName</VAR>.
1362 boolean CanPaste(in string theComponentName, in long theObjectID);
1364 Returns the %SObject of the pasted object.
1366 SObject PasteInto(in TMPFile theStream, in long theObjectID, in SObject theObject);