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