Salome HOME
4c21467c8720ddaf9f7f8a15e8ef11c57691b395
[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 /*!
31   \file SALOMEDS.idl This file contains a set of interfaces used for creation, managment
32   and modification of the %Study
33 */
34
35 #ifndef _SALOMEDS_IDL_
36 #define _SALOMEDS_IDL_
37
38 #include "SALOME_Exception.idl"
39 #include "SALOME_GenericObj.idl"
40
41 /*!
42      This package contains the interfaces used for creation, managment
43      and modification of the %Study
44 */
45 module SALOMEDS
46 {
47 /*! \typedef URL
48     Name of the file in which the %Study is saved.
49
50 */
51   typedef string URL;
52
53 /*! Main identifier of an object in %SALOME application
54 */
55   typedef string ID;
56
57 /*! While saving the data, IOR is transformed into persistent reference
58 */
59   typedef string PersistentReference;
60
61 /*! IOR of the study in %SALOME application
62 */
63   typedef string SalomeReference;
64
65 /*! List of the names of studies which are currently open in this %SALOME session.
66 Since %SALOME is a multi-study application, it allows to open a lot of studies
67 during each working session.
68 */
69   typedef sequence<string> ListOfOpenStudies;
70 /*! List of file names
71 */
72   typedef sequence<string> ListOfFileNames;
73 /*! List of modification dates of a study
74 */
75   typedef sequence<string> ListOfDates ;
76 /*! An unbounded sequence of strings
77 */
78   typedef sequence<string> ListOfStrings ;
79 /*! A byte stream which is used for binary data transfer between different components
80 */
81   typedef sequence<octet> TMPFile;
82
83   // Reference to other objects is treated with function AddReference
84   // and ReferencedObject
85   // All other type of attributes defined in AttributeType enum are
86   // treated with AddAdttribute and GetAttribute
87   // The difference is made because Reference attribute don't contain
88   // strings but reference to ID of other objects
89
90   interface GenericAttribute;
91   interface Study;
92   interface StudyManager;
93   interface StudyBuilder;
94   interface SObject;
95   interface SComponent;
96   interface SComponentIterator;
97   interface ChildIterator;
98   interface Driver;
99   interface AttributeStudyProperties;
100   interface AttributeParameter;
101   interface UseCaseIterator;
102   interface UseCaseBuilder;
103
104 /*! List of attributes of %SObjects
105 */
106   typedef sequence<GenericAttribute> ListOfAttributes;
107
108 /*! Exception indicating that this feature hasn't been implemented in %SALOME PRO application.
109 */
110   exception NotImplemented {};
111
112
113   //===========================================================================
114  /*! \brief %Study Interface
115
116     The purpose of the %Study is to manage the data produced by various components of %SALOME platform.
117    Most of the %Study operations are handled by the StudyManager and the StudyBuilder.
118    What is left in the %Study interface are elementary inquiries.
119    (Incidentally, we recall that a CORBA attribute is implemented as a pair of get
120       and set methods.) A %Study is explored by a set of tools, mainly iterators
121     , which are described further. Nevertheless, the %Study
122      interface allows the search of an object by name or by ID.
123      \note
124      <BR><VAR>The Path </VAR>of an object in %SALOME application is much alike a standard path of a file.
125     In general it's a string of names of directories divided by a slash '/'.
126      <BR><VAR>The Context</VAR> is the current directory of an object.</P>
127 */
128
129   interface Study
130   {
131
132     exception StudyInvalidContext {};
133     exception StudyInvalidComponent {};
134 /*! Invalid directory of the %study exception
135 */
136     exception StudyInvalidDirectory {};
137 /*! Exception pointing that this name of the study has already been used.
138 */
139     exception StudyNameAlreadyUsed {};
140     exception StudyObjectAlreadyExists {};
141 /*! Invalid name of the %study exception
142 */
143     exception StudyNameError {};
144     exception StudyCommentError {};
145 /*! \brief The name of the %Study
146
147    This is equivalent to the methods setName() & getName()
148 */
149     attribute string     Name; // equivalent to setName() & getName()
150 /*! \brief The ID of the %Study
151
152    This is equivalent to the methods setID() & getID()
153 */
154     attribute short      StudyId;
155 /*! Sequence containing %SObjects
156 */
157     typedef sequence<SObject> ListOfSObject;
158 /*!
159   Gets the persistent reference to the %Study.
160 */
161     PersistentReference  GetPersistentReference();
162 /*!
163   Gets a transient reference to the %Study.
164 */
165     SalomeReference      GetTransientReference();
166
167 /*!
168     Returns True if the %Study is empty
169 */
170     boolean IsEmpty();
171 /*!
172     Allows to find a %SComponent by its name.
173    \param aComponentName    It's a string value in the Comment Attribute of the Component,
174     which is looked for, defining the data type of this Component.
175
176 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
177 */
178     SComponent FindComponent  (in string aComponentName);
179 /*!
180     Allows to find a %SComponent by ID of the according %SObject
181 */
182     SComponent FindComponentID(in ID aComponentID);
183 /*!
184     Allows to find a %SObject by the Name Attribute of this %SObject
185
186     \param anObjectName String parameter defining the name of the object
187     \return The obtained %SObject
188
189 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
190
191 */
192     SObject       FindObject      (in string anObjectName);
193 /*!
194     Allows to find a %SObject by its ID
195     \param aObjectID This parameter defines the ID of the required object
196     \return The obtained %SObject
197
198 */
199     SObject       FindObjectID    (in ID aObjectID);
200 /*!
201     Allows to create a %SObject by its ID
202     \param aObjectID This parameter defines the ID of the required object
203     \return The created %SObject
204
205 */
206     SObject       CreateObjectID    (in ID aObjectID);
207 /*!
208     Allows to find a %SObject by IOR of the object belonging to this %SObject.
209     \param anObjectName This parameter defines the IOR of the object
210     \return The obtained %SObject
211
212 */
213     SObject       FindObjectIOR   (in ID aObjectIOR);
214 /*!
215     Finds in the study all %SObjects produced by a given %Component.
216     \param anObjectName The Name Attribute of the searched %SObjects should correspond to <VAR>anObjectName</VAR>.
217     \param aComponentName The name of the component, which objects are searched for.
218 */
219     ListOfSObject FindObjectByName(in string anObjectName, in string aComponentName);
220 /*!
221     Allows to find a %SObject by the path to it.
222
223     \param thePath The path to the required %SObject.
224     \return The obtained %SObject.
225
226 */
227     SObject FindObjectByPath(in string thePath);
228 /*!
229     Returns the path to the %SObject.
230 */
231     string  GetObjectPath(in Object theObject);
232
233 /*!
234     Sets the context of the %Study.
235     \param thePath String parameter defining the context of the study.
236
237 <BR><VAR>See also <A href=exemple/Example23.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
238
239 */
240     void SetContext(in string thePath);
241 /*!
242     Gets the context of the %Study.
243     
244 <BR><VAR>See also <A href=exemple/Example23.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
245
246 */
247     string GetContext();
248 /*!
249    Returns a list of names of objects corresponding to the context.
250    \note  If the parameter <VAR>theContext</VAR> is empty, then the current context will be used.
251 */
252     ListOfStrings GetObjectNames(in string theContext);
253 /*!
254    Returns a list of names of directories and subdirectories corresponding to the context.
255    \note  If the parameter <VAR>theContext</VAR> is empty, then the current context will be used.
256 */
257     ListOfStrings GetDirectoryNames(in string theContext);
258 /*!
259    Returns a list of names of Files corresponding to the context.
260     \note  If the parameter <VAR>theContext</VAR> is empty, then the current context will be used.
261 */
262     ListOfStrings GetFileNames(in string theContext);
263 /*!
264    Returns a list of names of Components corresponding to the context.
265    \note  If the parameter <VAR>theContext</VAR> is empty, then the current context will be used.
266 */
267     ListOfStrings GetComponentNames(in string theContext);
268 /*!
269     Creates a new iterator of child levels of the given %SObject.
270     \param aSO The given %SObject
271     \return A new iterator of child levels of the given %SObject.
272 */
273     ChildIterator      NewChildIterator(in SObject aSO);
274 /*!
275
276     Creates a new iterator of the %SComponents.
277
278     \return A new iterator of the %SComponents.
279 */
280     SComponentIterator NewComponentIterator();
281 /*!
282    Creates a new %StudyBuilder to add or modify an object in the study.
283
284    \return A new %StudyBuilder.
285
286 <BR><VAR>See also <A href=exemple/Example20.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
287
288 */
289     StudyBuilder NewBuilder() ;
290 /*! \brief Labels dependency
291
292     Updates the map with IOR attribute. It's an inner method used for optimization.
293 */
294     void UpdateIORLabelMap(in string anIOR, in string anEntry);
295
296 /*! \brief Getting properties of the study
297
298    Returns the attriubte, which contains the properties of this study.
299
300 <BR><VAR>See also <A href=exemple/Example20.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
301
302 */
303     AttributeStudyProperties GetProperties();
304 /*!
305    Determines whether the %study has been saved
306 */
307     attribute boolean IsSaved;
308 /*!
309   Returns True if the %study has been modified and not saved.
310 */
311     boolean IsModified();
312 /*!
313    Determines the file where the %study has been saved
314 */
315     attribute string  URL;
316
317 /*! \brief List of %SObjects
318
319     Returns the list of %SObjects which refers to %anObject.
320 */
321     ListOfSObject FindDependances(in SObject anObject);
322
323 /*! \brief The date of the last saving of the study
324
325     Returns the date of the last saving of study with format: "DD/MM/YYYY HH:MM"
326 */
327     string GetLastModificationDate();
328 /*! \brief The list of modification dates of the study
329
330     Returns the list of modification dates (without creation date) with format "DD/MM/YYYY HH:MM".
331       Note : the first modification begins the list.
332 */
333     ListOfDates GetModificationsDate();
334 /*! \brief Object conversion.
335
336     Converts an object into IOR.
337     \return    IOR
338 */
339     string ConvertObjectToIOR(in Object theObject);
340 /*! \brief Object conversion.
341
342     Converts IOR into an object.
343     \return    An object
344 */
345     Object ConvertIORToObject(in string theIOR);
346 /*!
347     Gets a new %UseCaseBuilder.
348 */
349     UseCaseBuilder  GetUseCaseBuilder();
350
351 /*!
352     Closes the components in the study, removes itself from the %StudyManager.
353 */
354     void Close();
355
356 /*!
357     Enables(if isEnabled = True)/disables automatic addition of new %SObjects to the use case.
358 */
359     void EnableUseCaseAutoFilling(in boolean isEnabled);
360
361 /*!
362     Functions for internal usage only
363 */
364     void AddPostponed(in string theIOR);
365
366     void AddCreatedPostponed(in string theIOR);
367
368     void RemovePostponed(in long theUndoLimit);
369
370     void UndoPostponed(in long theWay);
371
372     boolean DumpStudy(in string thePath, in string theBaseName, in boolean isPublished);
373
374 /*!
375     Returns an AttributeParameter used to store common parameters for given %theSavePoint.
376     \param theID identifies a common parameters set (Example: "Interface Applicative")
377     \param theSavePoint is number of a set of parameters as there can be several sets
378 */
379     AttributeParameter GetCommonParameters(in string theID, in long theSavePoint);
380
381 /*!
382     Returns an AttributeParameter used to store parameters for given %theModuleName.
383     \param theID identifies a common parameters set (Example: "Interface Applicative")
384     \param theModuleName is a name of the module (Example: "Geometry")
385     \param theSavePoint is number of a set of parameters as there can be several sets
386 */
387     AttributeParameter GetModuleParameters(in string theID, in string theModuleName, in long theSavePoint);
388
389
390 /*!
391     Returns a default Python script to restore visual parameters for given %theModuleName.
392     \param theID identifies a common parameters set (Example: "Interface Applicative")
393     \param theModuleName is a name of the module (Example: "Geometry")
394 */
395     string GetDefaultScript(in string theID, in string theModuleName);
396
397 /*!
398     Private method, returns an implementation of this Study.
399    \param theHostname is a hostname of the caller
400    \param thePID is a process ID of the caller
401    \param isLocal is set True if the Study is launched locally with the caller
402 */
403     long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal);
404
405   };
406
407   //==========================================================================
408 /*! \brief %Study Builder Interface
409
410   The purpose of the Builder is to add and/or remove objects and attributes.
411   A %StudyBuilder is linked to a %Study. A
412   command management is provided for the undo/redo functionalities.
413   \note
414   <BR><VAR>The Tag</VAR> of an item in %SALOME application is a symbolic description of
415   item's position in the tree-type structure of the browser. In general it has the following
416   form: <TT>0:2:1:1</TT>
417 */
418   //==========================================================================
419
420   interface StudyBuilder
421   {
422 /*! \brief %LockProtection Exception
423
424     This exception is raised while attempting to modify a locked %study.
425 */
426     exception LockProtection {};
427 /*! \brief Creation of a new %SComponent.
428
429    Creates a new %SComponent
430    \param ComponentDataType    Data type of the %SComponent which will be created.
431
432 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
433
434 */
435     SComponent NewComponent(in string ComponentDataType) raises(LockProtection);
436 /*! \brief Definition of the instance to the %SComponent
437
438     Defines the instance to the %SComponent.
439 */
440     void       DefineComponentInstance (in SComponent aComponent,in Object ComponentIOR) raises(LockProtection);
441         
442 /*! \brief Deletion of a %SComponent
443
444   Removes a %SComponent.
445 */
446     void       RemoveComponent(in SComponent aComponent) raises(LockProtection);
447
448 /*! \brief Creation of a new %SObject
449
450    Creates a new %SObject under a definite father %SObject.
451
452    \param theFatherObject The father %SObject under which this one should be created.
453    \return New %SObject
454
455 <BR><VAR>See also <A href=exemple/Example18.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
456
457 */
458
459     SObject NewObject      (in SObject theFatherObject) raises(LockProtection);
460
461 /*! \brief Creation of a new %SObject with a definite %tag
462
463    Creates a new %SObject with a definite %tag.
464
465    \param atag Long value corresponding to the tag of the new %SObject.
466    \return New %SObject
467
468 */
469     SObject NewObjectToTag (in SObject theFatherObject, in long atag) raises(LockProtection);
470 /*! \brief Deletion of the %SObject
471
472   Removes a %SObject from the %StudyBuilder.
473
474   \param anObject The %SObject to be deleted.
475 */
476     void    RemoveObject   (in SObject anObject) raises(LockProtection);
477 /*! \brief Deletion of the %SObject with all his child objects.
478
479   Removes the %SObject with all his child objects.
480
481   \param anObject The %SObject to be deleted with all child objects.
482 */
483     void    RemoveObjectWithChildren(in SObject anObject) raises(LockProtection);
484
485 /*!
486    Loads a %SComponent.
487
488 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
489
490 */
491     void  LoadWith (in SComponent sco, in Driver Engine) raises (SALOME::SALOME_Exception);
492 /*!
493    Loads a %SObject.
494
495    \param sco %SObject to be loaded.
496 */
497     void  Load (in SObject sco);
498
499 /*! \brief Looking for or creating an attribute assigned to the %SObject
500
501     Allows to find or create an attribute of a specific type which is assigned to the object.
502     \param anObject        The %SObject corresponding to the attribute which is looked for.
503     \param aTypeOfAttribute     Type of the attribute.
504
505   <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
506 */
507
508     GenericAttribute FindOrCreateAttribute(in  SObject        anObject,
509                                          in  string         aTypeOfAttribute) raises(LockProtection);
510
511 /*! \brief Looking for an attribute assigned to a %SObject
512
513     Allows to find an attribute of a specific type which is assigned to the object.
514     \param anObject        The %SObject corresponding to the attribute which is looked for.
515     \param aTypeOfAttribute     Type of the attribute.
516     \param anAttribute       Where the attribute is placed if it's found.
517     \return True if it finds an attribute.
518  */
519
520     boolean FindAttribute(in  SObject        anObject,
521                                  out GenericAttribute anAttribute,
522                                  in  string         aTypeOfAttribute);
523 /*! \brief Deleting the attribute assigned to the %SObject
524
525     Removes the attribute of a specific type which is assigned to the object.
526     \param anObject        The %SObject corresponding to the attribute.
527     \param aTypeOfAttribute     Type of the attribute.
528
529 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
530 */
531     void RemoveAttribute(in  SObject        anObject,
532                          in  string         aTypeOfAttribute) raises(LockProtection);
533 /*!
534     Adds a reference between %anObject and %theReferencedObject.
535     \param anObject The %SObject which will get a reference
536     \param theReferencedObject The %SObject having a reference
537 */
538
539     void Addreference(in SObject anObject,
540                       in SObject theReferencedObject) ;
541
542 /*!
543     Removes a reference from %anObject to another object.
544     \param anObject The %SObject which contains a reference
545 */
546
547     void RemoveReference(in SObject anObject) ;
548
549 /*!
550    Adds a directory in the %Study.
551    \param theName String parameter defining the name of the directory.
552
553 <BR><VAR>See also <A href=exemple/Example23.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
554
555 */
556     void AddDirectory(in string theName) raises(LockProtection);
557
558 /*! \brief Identification of the %SObject's substructure.
559
560       Identification of the %SObject's substructure by GUID.
561
562
563       \param anObject The %SObject which will be identified
564       \param theGUID GUID has the following format "00000000-0000-0000-0000-000000000000"
565 */
566
567      void SetGUID(in SObject anObject, in string theGUID) raises(LockProtection);
568 /*!
569 Searches for a definite %SObject with a definite GUID and returns True if it finds it.
570
571 \param anObject A definite %SObject which will be identified
572 \param theGUID GUID has the following format "00000000-0000-0000-0000-000000000000"
573 */
574      boolean IsGUID(in SObject anObject, in string theGUID);
575
576 /*! \brief Creation of a new command
577
578    Creates a new command which can contain several different actions.
579    
580 <BR><VAR>See also <A href=exemple/Example3.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
581
582 */
583     void NewCommand(); // command management
584 /*! \brief Execution of the command
585
586    Commits all actions declared within this command.
587
588    \exception LockProtection This exception is raised, when trying to perform this command a study, which is protected for modifications.
589
590 <BR><VAR>See also <A href=exemple/Example16.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
591
592 */
593     void CommitCommand() raises(LockProtection); // command management
594 /*!
595     Returns True if at this moment there is a command under execution.
596 */
597     boolean HasOpenCommand();
598 /*! \brief Cancelation of the command
599
600     Cancels all actions declared within the command.
601     
602 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
603 */
604     void AbortCommand(); // command management
605 /*! \brief Undolimit
606
607     The number of actions which can be undone
608 */
609     attribute long  UndoLimit;
610 /*! \brief Undo method
611
612     Cancels all actions of the last command.
613
614     \exception LockProtection This exception is raised, when trying to perform this command a study, which is protected for modifications.
615
616 <BR><VAR>See also <A href=exemple/Example16.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
617
618 */
619     void Undo() raises (LockProtection);
620 /*! \brief Redo method
621
622     Redoes all actions of the last command.
623
624 \exception LockProtection This exception is raised, when trying to perform this command a study, which is protected for modifications.
625
626  <BR><VAR>See also <A href=exemple/Example16.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
627
628 */
629     void Redo() raises (LockProtection);
630 /*!
631     Returns True if at this moment there are any actions which can be canceled.
632     
633    <BR><VAR>See also <A href=exemple/Example16.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
634
635 */
636     boolean GetAvailableUndos();
637 /*!
638     Returns True if at this moment there are any actions which can be redone.
639
640    <BR><VAR>See also <A href=exemple/Example3.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
641
642 */
643     boolean GetAvailableRedos();
644 /*!
645     Puts name attribute with the given string value to the given %SObject
646
647     \param theSO Existing SObject to set name attribute.
648     \param theValue The value to be set to the name attribute.
649 */
650     void SetName(in SObject theSO, in string theValue) raises (LockProtection);
651
652 /*!
653     Puts comment attribute with the given string value to the given %SObject
654
655     \param theSO Existing SObject to set comment attribute.
656     \param theValue The value to be set to the comment attribute.
657 */
658     void SetComment(in SObject theSO, in string theValue) raises (LockProtection);
659
660 /*!
661     Puts IOR attribute with the given string value to the given %SObject
662
663     \param theSO Existing SObject to set IOR attribute.
664     \param theValue The value to be set to the IOR attribute.
665 */
666     void SetIOR(in SObject theSO, in string theValue) raises (LockProtection);
667   };
668
669   //==========================================================================
670 /*! \brief %Study Manager interface
671
672     The purpose of the Manager is to manipulate the %Studies. You will find in this
673     interface the methods to create, open,
674     close, and save a %Study. Since a %SALOME session is multi-document, you will
675     also find the methods allowing to navigate
676     through the collection of studies present in a session.
677 */
678   //==========================================================================
679
680   interface StudyManager
681   {
682 /*!
683     Determines whether the server has already been loaded or not.
684 */
685     void ping();
686
687 /*! \brief Creation of a new study
688
689      Creates a new study with a definite name.
690
691      \param study_name String parameter defining the name of the study
692
693 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
694
695 */
696     Study NewStudy(in string study_name);
697
698 /*! \brief Open a study
699
700      Reads and activates the structure of the study %Objects.
701      \param aStudyUrl The path to the study
702     \warning This method doesn't activate the corba objects. Only a component can do it.
703
704 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
705 */
706     Study Open (in URL aStudyUrl) raises (SALOME::SALOME_Exception);
707
708 /*! \brief Closing the study
709
710     Closes a study.
711 */
712     void  Close(in Study aStudy);
713 /*! \brief Saving the study in a HDF file (or files).
714
715     Saves a study.
716
717     \param theMultiFile If this parameter is True the study will be saved in several files.
718
719 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
720
721 */
722     boolean  Save(in  Study aStudy, in boolean theMultiFile);
723 /*! \brief Saving a study in a ASCII file (or files).
724
725     Saves a study in an ASCII format file (or files).
726     \param theMultiFile If this parameter is True the study will be saved in several files.
727 */
728     boolean  SaveASCII(in  Study aStudy, in boolean theMultiFile);
729 /*! \brief Saving the study in a specified HDF file (or files).
730
731     Saves the study in a specified file (or files).
732     \param aUrl The path to the definite file in whcih the study will be saved
733     \param aStudy The study which will be saved
734     \param theMultiFile If this parameter is True the study will be saved in several files.
735
736  <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
737 */
738     boolean  SaveAs(in URL   aUrl, // if the file already exists
739                 in Study aStudy,
740                 in boolean theMultiFile); // overwrite (as option)
741 /*! \brief Saving the study in a specified ASCII file (or files).
742
743     Saves the study in a specified ASCII file (or files).
744
745     \param aUrl The path to the definite file in whcih the study will be saved
746     \param aStudy The study which will be saved
747     \param theMultiFile If this parameter is True the study will be saved in several files.
748 */
749     boolean  SaveAsASCII(in URL   aUrl, // if the file already exists
750                       in Study aStudy,
751                       in boolean theMultiFile); // overwrite (as option)
752
753
754 /*! \brief List of open studies.
755
756 Gets the list of open studies
757
758     \return A list of open studies in the current session.
759 */
760     ListOfOpenStudies GetOpenStudies();
761
762 /*! \brief Getting a particular %Study picked by name
763
764     Activates a particular %Study
765     among the session collection picking it by name.
766     \param aStudyName The name of the study
767 */
768     Study GetStudyByName  (in string aStudyName);
769
770 /*! \brief Getting a particular %Study picked by ID
771
772     Activates a particular %Study
773     among the session collection picking it by ID.
774     \param aStudyID The ID of the study
775 */
776     Study GetStudyByID  (in short aStudyID);
777
778     // copy/paste methods
779
780 /*!
781     Returns True, if the given %SObject can be copied to the clipboard.
782 */
783     boolean CanCopy(in SObject theObject);
784 /*!
785     Returns True, if the given %SObject is copied to the clipboard.
786     \param theObject The %SObject which will be copied
787 */
788     boolean Copy(in SObject theObject);
789 /*!
790     Returns True, if the object from the clipboard can be pasted to the given %SObject.
791     \param theObject The %SObject stored in the clipboard.
792 */
793     boolean CanPaste(in SObject theObject);
794 /*!
795     Returns the %SObject in which the object from the clipboard was pasted to.
796     \param theObject The %SObject which will be pasted
797     \exception SALOMEDS::StudyBuilder::LockProtection This exception is raised, when trying to paste
798     an object into a study, which is protected for modifications.
799 */
800     SObject Paste(in SObject theObject) raises (SALOMEDS::StudyBuilder::LockProtection);
801
802 /*! \brief Object conversion.
803
804     Converts an object into IOR.
805     \return    IOR
806 */
807     string ConvertObjectToIOR(in Object theObject);
808 /*! \brief Object conversion.
809             
810     Converts IOR into an object.
811     \return    An object
812 */
813     Object ConvertIORToObject(in string theIOR); 
814
815 /*!
816     Private method, returns an implementation of this StudyManager.
817    \param theHostname is a hostname of the caller
818    \param thePID is a process ID of the caller
819    \param isLocal is set True if the StudyManager is launched locally with the caller
820 */
821     long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); 
822
823
824   };
825
826
827   //==========================================================================
828 /*! \brief %SObject interface
829
830    The objects in the %study are built by the %StudyBuilder. The %SObject interface
831    provides methods for elementary inquiries, like getting an object %ID or its attribuites.
832  \note
833  
834    <BR><VAR>Tag</VAR> of an item in %SALOME application is an integer value uniquely defining an item
835    in the tree-type data structure.
836    <BR><VAR>ID</VAR> of an item is a description of item's position in the tree-type data structure.
837    ID is a list of tags and it has the following form: <TT>0:2:1:1</TT>.
838 */
839   //==========================================================================
840
841   interface SObject : SALOME::GenericObj
842   {
843 /*! Name of the %SObject
844 */
845     attribute string Name; // equivalent to setName() & getName()
846 /*! Gets an object %ID
847
848    \return ID of the %SObject.
849 */
850     ID GetID();
851 /*!  Acquisition of the father %Component of the %SObject
852
853   \return The father %Component of the %SObject.
854 */
855     SComponent GetFatherComponent();
856 /*! Acquisition of the father %SObject of the %SObject
857
858    \return the father %SObject of the given %SObject.
859 */
860     SObject    GetFather();
861 /*! Gets the %tag of a %SObject
862
863     \return the %tag of a %SObject.
864 */
865     short      Tag();
866 /*! Gets the depth of a %SObject
867
868     \return the depth of a %SObject.
869 */
870     short      Depth();
871 /*! Looks for subobjects of a given %SObject.
872
873     \param atag Tag of the given %SObject
874     \return True if it finds a subobject of the %SObject with a definite tag as well as the required subobject.
875 */
876
877     boolean FindSubObject (in long atag, out SObject obj);
878 /*! Looks for attributes of a given %SObject
879
880    \param aTypeOfAttribute String value defining the type of the required attribute of the given %SObject.
881    \return True if it finds an attribute of a definite type of the given %SObject as well as the discovered attribute.
882
883 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
884 */
885     boolean FindAttribute(out GenericAttribute anAttribute,
886                                   in  string         aTypeOfAttribute);
887 /*! Looks for a %SObject which the given %SObject refers to.
888
889     \return The object which the given %SObject refers to as well as True if it finds
890     this object.
891 */
892     boolean ReferencedObject(out SObject obj); // A REVOIR
893 /*! Gets all attributes of a given %SObject
894
895     \return The list of all attributes of the given %SObject.
896
897 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
898
899 */
900     ListOfAttributes     GetAllAttributes();
901 /*! Gets the study of a given %SObject.
902
903     \return The study containing the given %SObject.
904 */
905     Study GetStudy();
906
907 /*! Gets the CORBA object by its own IOR attribute.
908     Returns nil, if can't.
909
910     \return The CORBA object of the %SObject.
911 */
912     Object GetObject();
913
914 /*!
915     Returns the name attribute value of this SObject.
916     Returns empty string if there is no name attribute.
917 */
918     string GetName();
919
920 /*!
921     Returns the comment attribute value of this SObject.
922     Returns empty string if there is no comment attribute.
923 */
924     string GetComment();
925
926 /*!
927     Returns the IOR attribute value of this SObject.
928     Returns empty string if there is no IOR attribute.
929 */
930     string GetIOR();
931
932 /*!
933     Private method, returns an implementation of this SObject.
934    \param theHostname is a hostname of the caller
935    \param thePID is a process ID of the caller
936    \param isLocal is set True if the SObject is launched locally with the caller
937 */
938     long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal);
939   };
940
941
942   //==========================================================================
943 /*! \brief %Generic attribute interface
944
945    %Generic attribute is a base interface for all attributes which can be assigned to the SObjects created in the study.
946 */
947   //==========================================================================
948   interface GenericAttribute : SALOME::GenericObj
949   {
950 /*! \brief Exception locking all changes
951
952     This exception locks all modifications in attributes.
953 */
954     exception LockProtection {};
955 /*! \brief Method CheckLocked
956
957    Checks whether the %Study is protected for modifications.
958
959    \note <BR>This exception is raised only outside a transaction.
960 */
961     void CheckLocked() raises (LockProtection);
962
963     string Type();
964
965     string GetClassType();      
966         
967     SObject GetSObject();
968
969 /*!
970     Private method, returns an implementation of this GenericAttribute.
971    \param theHostname is a hostname of the caller
972    \param thePID is a process ID of the caller
973    \param isLocal is set True if the GenericAttribute is launched locally with the caller
974 */
975     long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal);
976   };
977
978
979
980   //==========================================================================
981 /*! \brief %SComponent interface
982
983    The %SComponent interface establishes in the study a permanent assocition to the Components integrated into %SALOME platform.
984    The %SComponent interface is a specialization of the %SObject interface.
985    It inherits the most of its methods from the %SObject interface.
986 */
987   //==========================================================================
988   interface SComponent : SObject
989   {
990 /*! Gets the data type of the given %SComponent
991
992     \return The data type of this %SComponent.
993 */
994     string  ComponentDataType();
995 /*! Gets the IOR of the given component
996
997   \return True (if there is an instance of the given component) and its IOR.
998 */
999     boolean ComponentIOR (out ID theID); //returns True if there is an instance
1000                                          //In this case ID identifies this one
1001   };
1002
1003
1004   //==========================================================================
1005 /*! \brief %SComponentIterator interface
1006
1007   This interface contains the methods allowing to iterate over all components in the list.
1008   The search is started from the first %SComponent in the list.
1009 */
1010   //==========================================================================
1011   interface SComponentIterator : SALOME::GenericObj
1012   {
1013 /*!
1014 Activates the %SComponentIterator.
1015 */
1016     void Init();
1017 /*!  Method More
1018
1019    \return True if there is one more %SComponent in the list.
1020 */
1021     boolean More();
1022 /*!
1023 Moves the iterator to the next %SComponent in the list.
1024 */
1025     void Next();
1026 /*!
1027     Returns the %SComponent corresponding to the current %SComponent found by the iterator.
1028
1029  <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
1030
1031 */
1032     SComponent Value();
1033   };
1034
1035   //==========================================================================
1036 /*! \brief %ChildIterator interface
1037
1038     This interface contains methods which allow to iterate over all child
1039     levels.
1040 */
1041   //==========================================================================
1042   interface ChildIterator : SALOME::GenericObj
1043   {
1044 /*!
1045
1046 Activates the %ChildIterator.
1047 */
1048     void Init();
1049 /*!
1050
1051 Activates the %ChildIterator for all child levels.
1052
1053 \param allLevels If this boolean parameter is True, the %ChildIterator will be activated for all child levels.
1054 */
1055     void InitEx(in boolean allLevels);
1056 /*! Method More
1057
1058    \return True if there is one more %ChildIterator in the list.
1059 */
1060     boolean More();
1061 /*!
1062     Passes the iterator to the next level.
1063 */
1064     void Next();
1065 /*!
1066     Returns the %SObject corresponding to the current object found by the iterator.
1067 */
1068     SObject Value();
1069   };
1070
1071   //==========================================================================
1072   //==========================================================================
1073 /*! \brief Interface of the %UseCaseIterator.
1074
1075    This interface contains a set of methods used for iteration over the objects in the use case.
1076 */
1077   interface UseCaseIterator : SALOME::GenericObj
1078   {
1079 /*!
1080 Activates the %UseCaseIterator.
1081 \param allLevels If the value of this parameter is True the Iterator is activated for all subobjects.
1082 */
1083     void Init(in boolean allLevels);
1084 /*! Method More
1085
1086     \return True if the %UseCaseIterator finds one more object.
1087 */
1088     boolean More();
1089 /*!
1090     Passes the iterator to the next object.
1091 */
1092     void Next();
1093 /*!
1094     Returns the %SObject corresponding to the current object found by the Iterator.
1095 */
1096     SObject Value();
1097   };
1098
1099   //==========================================================================
1100   //==========================================================================
1101 /*! \brief Interface of the %UseCaseBuilder
1102
1103    Use case in the study represents a user-managed subtree, containing all or some of the objects which exist in the study.
1104    The %UseCaseBuilder interface contains a set of methods used for management of the use case in the study.
1105 */
1106   interface UseCaseBuilder : SALOME::GenericObj
1107   {
1108 /*!
1109    Adds to the use case an object as a child of the current object of the use case.
1110
1111    \param theObject The added %SObject.
1112    \return True if this %SObject has been added in the use case.
1113 */
1114     boolean Append(in SObject theObject);
1115 /*!
1116    Removes an object from the use case.
1117
1118    \param theObject The deleted %SObject
1119    \return True if this %SObject has been deleted from the use case.
1120 */
1121     boolean Remove(in SObject theObject);
1122 /*!
1123    Adds a child object <VAR>theObject</VAR> to the given father <VAR>theFather</VAR> object in the use case.
1124 */
1125     boolean AppendTo(in SObject theFather, in SObject theObject);
1126 /*!
1127     Inserts in the use case the object <VAR>theFirst</VAR> before the object <VAR>theNext</VAR>.
1128 */
1129     boolean InsertBefore(in SObject theFirst, in SObject theNext);
1130 /*!
1131     Sets the current object of the use case.
1132 */
1133     boolean SetCurrentObject(in SObject theObject);
1134 /*!
1135     Makes the root object to be the current object of the use case.
1136 */
1137     boolean SetRootCurrent();
1138 /*!
1139    Returns True if the given object <VAR>theObject</VAR> of the use case has child objects.
1140 */
1141     boolean HasChildren(in SObject theObject);
1142 /*!
1143    Sets the name of the use case.
1144 */
1145     boolean SetName(in string theName);
1146 /*!
1147    Gets the name of the use case.
1148 */
1149     string GetName();
1150 /*!
1151    Returns True if the given object <VAR>theObject</VAR> represents a use case.
1152 */
1153     boolean IsUseCase(in SObject theObject);
1154 /*!
1155     Gets the current object of the use case.
1156 */
1157     SObject GetCurrentObject();
1158 /*!
1159     Creates a new use case in the use case browser.
1160 */
1161     SObject AddUseCase(in string theName);
1162 /*!
1163     Returns the %UseCaseIterator for the given object <VAR>theObject</VAR> in the use case.
1164 */
1165     UseCaseIterator GetUseCaseIterator(in SObject theObject);
1166   };
1167   //==========================================================================
1168 /*! \brief %Driver interface
1169
1170 This class represents a common tool for all components integrated into SALOME application, that allows them to communicate with the study. It contains a set of methods which
1171 can be called by any component and which provide the following functionality:
1172 <ul>
1173     <li> publishing in the study of the objects created by a definite component
1174     <li> saving/loading of the data created by a definite component. These methods are called by the StudyManager when loading/saving a study containing the data created by a definite component.
1175     <li> transforming of the transient references into persistant references (or vice versa) of the SObjects when saving (or loading) a study
1176     <li> copy/paste common functionality. These methods can be called by any component in order to copy/paste its object created in the study
1177 </ul>
1178
1179 */
1180   //==========================================================================
1181   interface Driver
1182   {
1183
1184     /*! \brief Saving the data produced by a definite component.
1185
1186         This method is called by the StudyManager when saving a study.
1187        \param theComponent    %SComponent corresponding to this Component
1188        \param theURL  The path to the file in which the data will be saved.
1189        \param isMultiFile  If the value of this boolean parameter is True, the data will be saved in several files.
1190        \return A byte stream TMPFile that contains all saved data
1191
1192 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
1193
1194      */
1195
1196
1197     TMPFile Save(in SComponent theComponent, in string theURL, in boolean isMultiFile);
1198
1199 /*! \brief Saving the data in ASCII format produced by a definite component.
1200
1201         This method is called by the StudyManager when saving a study in ASCII format.
1202        \param theComponent    %SComponent corresponding to this Component
1203        \param theURL  The path to the file in which the data will be saved.
1204        \param isMultiFile  If the value of this boolean parameter is True, the data will be saved in several files.
1205        \return A byte stream TMPFile that will contain all saved data
1206
1207 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
1208
1209      */
1210     TMPFile SaveASCII(in SComponent theComponent, in string theURL, in boolean isMultiFile);
1211
1212     /*! \brief Loading the data.
1213
1214        This method is called by the StudyManager when opening a study.
1215        \param theComponent      %SComponent corresponding to this Component
1216        \param theStream   The file which contains all data saved by the component on Save method
1217        \param isMultiFile  If the value of this boolean parameter is True, the data will be loaded from several files
1218
1219      */
1220
1221     boolean Load(in SComponent theComponent, in TMPFile theStream, in string theURL, in boolean isMultiFile);
1222
1223     /*! \brief Loading the data from files in ASCII format.
1224
1225        This method is called by the StudyManager when opening a study.
1226        \param theComponent      %SComponent corresponding to this Component
1227        \param theStream   The file which contains all data saved by the component on Save method
1228        \param isMultiFile  If the value of this boolean parameter is True, the data will be loaded from several files
1229
1230      */
1231
1232     boolean LoadASCII(in SComponent theComponent, in TMPFile theStream, in string theURL, in boolean isMultiFile);
1233
1234     /*! \brief Closing of the study
1235
1236       This method Close is called by the StudyManager when closing a study.
1237     \param aSComponent The according %SComponent
1238      */
1239
1240     void Close (in SComponent aSComponent);
1241     //void Close ( in string  aIORSComponent);
1242
1243     /*! Gets the type of the data
1244
1245         \return The type of data produced by the Component in the study.
1246      */
1247
1248      string ComponentDataType();
1249
1250     // Driver Transient -> persistent called for each object in study
1251 /*!
1252    Transforms IOR of a given %SObject into PersistentID. It is called for each
1253    object in the %study.
1254 \note <br> In %SALOME the objects which are present in an active study are identified by an IOR, when this
1255 study is saved these references are transformed into persintent IDs.
1256
1257    \param theSObject The given %SObject.
1258    \param IORString The IOR of the given %SObject.
1259    \param isMultiFile If this parameter is True the study containing the given %SObject is stored in several files.
1260    \param isASCII If this parameter is True the study containing the given %SObject is stored in ASCII format.
1261
1262    \return The persistent ID of the given %SObject
1263
1264 */
1265     string IORToLocalPersistentID (in SObject theSObject,
1266                                    in string IORString,
1267                                    in boolean isMultiFile,
1268                                    in boolean isASCII);
1269 /*!
1270   Transforms PersistentID into IOR of the object. It is called for each
1271    object in the %study.
1272
1273    \note <br> In %SALOME the objects which are present in an saved study (file) are identified by a persistent ID, when this
1274 study is open, these references are transformed into persintent IORs.
1275
1276    \param theSObject The given %SObject.
1277    \param IORString The IOR of the given %SObject.
1278    \param isMultiFile If this parameter is True the study containing the given %SObject is stored in several files.
1279    \param isASCII If this parameter is True the study containing the given %SObject is stored in ASCII format.
1280
1281    \return The IOR of the given %SObject
1282
1283 */
1284     string LocalPersistentIDToIOR (in SObject theSObject,
1285                                    in string aLocalPersistentID,
1286                                    in boolean isMultiFile,
1287                                    in boolean isASCII)
1288       raises (SALOME::SALOME_Exception);
1289
1290     // Publishing in the study
1291 /*! Publishing in the study
1292
1293     \return True if the given %Component can publish a definite object with a given IOR in the %study.
1294     \param theIOR The IOR of a definite object
1295 */
1296     boolean CanPublishInStudy(in Object theIOR) raises (SALOME::SALOME_Exception);
1297 /*! \brief Publishing in the study
1298
1299    Publishes the given object in the %study, using the algorithm of this component.
1300     \param theStudy     The %study in which the object is published
1301     \param theSObject     If this parameter is null the object is published for the first time. Otherwise
1302     this parameter should contain a reference to the object published earlier
1303     \param theObject      The object which is published
1304     \param theName      The name of the published object. If this parameter is empty, the name is generated
1305     automatically by the component.
1306
1307     \return The published %SObject.
1308 */
1309     SObject PublishInStudy(in Study theStudy, in SObject theSObject, in Object theObject, in string theName);
1310
1311     // copy/paste methods
1312
1313 /*!
1314     Returns True, if the given %SObject can be copied to the clipboard.
1315
1316     \param theObject The given %SObject which should be copied.
1317 */
1318     boolean CanCopy(in SObject theObject);
1319 /*!
1320     Returns the object %ID and the %TMPFile of the object from the given %SObject.
1321 */
1322     TMPFile CopyFrom(in SObject theObject, out long theObjectID);
1323 /*!
1324     Returns True, if the component can paste the object with given %ID of the component with name <VAR>theComponentName</VAR>.
1325 */
1326     boolean CanPaste(in string theComponentName, in long theObjectID);
1327 /*!
1328     Returns the %SObject of the pasted object.
1329 */
1330     SObject PasteInto(in TMPFile theStream, in long theObjectID, in SObject theObject);
1331
1332   };
1333 };
1334
1335 #endif