Salome HOME
PR: corrections residuelles des anomalies du merge cvs
[modules/yacs.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
40 /*!
41      This package contains the interfaces used for creation, managment
42      and modification of the %Study
43 */
44 module SALOMEDS
45 {
46 /*! \typedef URL
47     Name of the file in which the %Study is saved.
48
49 */
50   typedef string URL;
51
52 /*! Main identifier of an object in %SALOME application
53 */
54   typedef string ID;
55
56 /*! While saving the data, IOR is transformed into persistent reference
57 */
58   typedef string PersistentReference;
59
60 /*! IOR of the study in %SALOME application
61 */
62   typedef string SalomeReference;
63
64 /*! List of the names of studies which are currently open in this %SALOME session.
65 Since %SALOME is a multi-study application, it allows to open a lot of studies
66 during each working session.
67 */
68   typedef sequence<string> ListOfOpenStudies;
69 /*! List of file names
70 */
71   typedef sequence<string> ListOfFileNames;
72 /*! List of modification dates of a study
73 */
74   typedef sequence<string> ListOfDates ;
75 /*! An unbounded sequence of strings
76 */
77   typedef sequence<string> ListOfStrings ;
78 /*! A byte stream which is used for binary data transfer between different components
79 */
80   typedef sequence<octet> TMPFile;
81
82   // Reference to other objects is treated with function AddReference
83   // and ReferencedObject
84   // All other type of attributes defined in AttributeType enum are
85   // treated with AddAdttribute and GetAttribute
86   // The difference is made because Reference attribute don't contain
87   // strings but reference to ID of other objects
88
89   interface GenericAttribute;
90   interface Study;
91   interface StudyManager;
92   interface StudyBuilder;
93   interface SObject;
94   interface SComponent;
95   interface SComponentIterator;
96   interface ChildIterator;
97   interface Driver;
98   interface AttributeStudyProperties;
99   interface UseCaseIterator;
100   interface UseCaseBuilder;
101   interface Callback;
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
372   //==========================================================================
373 /*! \brief %Study Builder Interface
374
375   The purpose of the Builder is to add and/or remove objects and attributes.
376   A %StudyBuilder is linked to a %Study. A
377   command management is provided for the undo/redo functionalities.
378   \note
379   <BR><VAR>The Tag</VAR> of an item in %SALOME application is a symbolic description of
380   item's position in the tree-type structure of the browser. In general it has the following
381   form: <TT>0:2:1:1</TT>
382 */
383   //==========================================================================
384
385   interface StudyBuilder
386   {
387 /*! \brief %LockProtection Exception
388
389     This exception is raised while attempting to modify a locked %study.
390 */
391     exception LockProtection {};
392 /*! \brief Creation of a new %SComponent.
393
394    Creates a new %SComponent
395    \param ComponentDataType    Data type of the %SComponent which will be created.
396
397 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
398
399 */
400     SComponent NewComponent(in string ComponentDataType) raises(LockProtection);
401 /*! \brief Definition of the instance to the %SComponent
402
403     Defines the instance to the %SComponent.
404 */
405     void       DefineComponentInstance (in SComponent aComponent,in Object ComponentIOR) raises(LockProtection);
406 /*! \brief Deletion of a %SComponent
407
408   Removes a %SComponent.
409 */
410     void       RemoveComponent(in SComponent aComponent) raises(LockProtection);
411
412 /*! \brief Creation of a new %SObject
413
414    Creates a new %SObject under a definite father %SObject.
415
416    \param theFatherObject The father %SObject under which this one should be created.
417    \return New %SObject
418
419 <BR><VAR>See also <A href=exemple/Example18.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
420
421 */
422
423     SObject NewObject      (in SObject theFatherObject) raises(LockProtection);
424
425 /*! \brief Creation of a new %SObject with a definite %tag
426
427    Creates a new %SObject with a definite %tag.
428
429    \param atag Long value corresponding to the tag of the new %SObject.
430    \return New %SObject
431
432 */
433     SObject NewObjectToTag (in SObject theFatherObject, in long atag) raises(LockProtection);
434 /*! \brief Deletion of the %SObject
435
436   Removes a %SObject from the %StudyBuilder.
437
438   \param anObject The %SObject to be deleted.
439 */
440     void    RemoveObject   (in SObject anObject) raises(LockProtection);
441 /*! \brief Deletion of the %SObject with all his child objects.
442
443   Removes the %SObject with all his child objects.
444
445   \param anObject The %SObject to be deleted with all child objects.
446 */
447     void    RemoveObjectWithChildren(in SObject anObject) raises(LockProtection);
448
449 /*!
450    Loads a %SComponent.
451
452 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
453
454 */
455     void  LoadWith (in SComponent sco, in Driver Engine) raises (SALOME::SALOME_Exception);
456 /*!
457    Loads a %SObject.
458
459    \param sco %SObject to be loaded.
460 */
461     void  Load (in SObject sco);
462
463 /*! \brief Looking for or creating an attribute assigned to the %SObject
464
465     Allows to find or create an attribute of a specific type which is assigned to the object.
466     \param anObject        The %SObject corresponding to the attribute which is looked for.
467     \param aTypeOfAttribute     Type of the attribute.
468
469   <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
470 */
471
472     GenericAttribute FindOrCreateAttribute(in  SObject        anObject,
473                                          in  string         aTypeOfAttribute) raises(LockProtection);
474
475 /*! \brief Looking for an attribute assigned to a %SObject
476
477     Allows to find 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     \param anAttribute       Where the attribute is placed if it's found.
481     \return True if it finds an attribute.
482  */
483
484     boolean FindAttribute(in  SObject        anObject,
485                                  out GenericAttribute anAttribute,
486                                  in  string         aTypeOfAttribute);
487 /*! \brief Deleting the attribute assigned to the %SObject
488
489     Removes the attribute of a specific type which is assigned to the object.
490     \param anObject        The %SObject corresponding to the attribute.
491     \param aTypeOfAttribute     Type of the attribute.
492
493 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
494 */
495     void RemoveAttribute(in  SObject        anObject,
496                          in  string         aTypeOfAttribute) raises(LockProtection);
497 /*!
498     Adds a reference between %anObject and %theReferencedObject.
499     \param anObject The %SObject which will get a reference
500     \param theReferencedObject The %SObject having a reference
501 */
502
503     void Addreference(in SObject anObject,
504                       in SObject theReferencedObject) ;
505
506 /*!
507     Removes a reference from %anObject to another object.
508     \param anObject The %SObject which contains a reference
509 */
510
511     void RemoveReference(in SObject anObject) ;
512
513 /*!
514    Adds a directory in the %Study.
515    \param theName String parameter defining the name of the directory.
516
517 <BR><VAR>See also <A href=exemple/Example23.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
518
519 */
520     void AddDirectory(in string theName) raises(LockProtection);
521
522 /*! \brief Identification of the %SObject's substructure.
523
524       Identification of the %SObject's substructure by GUID.
525
526
527       \param anObject The %SObject which will be identified
528       \param theGUID GUID has the following format "00000000-0000-0000-0000-000000000000"
529 */
530
531      void SetGUID(in SObject anObject, in string theGUID) raises(LockProtection);
532 /*!
533 Searches for a definite %SObject with a definite GUID and returns True if it finds it.
534
535 \param anObject A definite %SObject which will be identified
536 \param theGUID GUID has the following format "00000000-0000-0000-0000-000000000000"
537 */
538      boolean IsGUID(in SObject anObject, in string theGUID);
539
540 /*! \brief Creation of a new command
541
542    Creates a new command which can contain several different actions.
543    
544 <BR><VAR>See also <A href=exemple/Example3.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
545
546 */
547     void NewCommand(); // command management
548 /*! \brief Execution of the command
549
550    Commits all actions declared within this command.
551
552    \exception LockProtection This exception is raised, when trying to perform this command a study, which is protected for modifications.
553
554 <BR><VAR>See also <A href=exemple/Example16.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
555
556 */
557     void CommitCommand() raises(LockProtection); // command management
558 /*!
559     Returns True if at this moment there is a command under execution.
560 */
561     boolean HasOpenCommand();
562 /*! \brief Cancelation of the command
563
564     Cancels all actions declared within the command.
565     
566 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
567 */
568     void AbortCommand(); // command management
569 /*! \brief Undolimit
570
571     The number of actions which can be undone
572 */
573     attribute long  UndoLimit;
574 /*! \brief Undo method
575
576     Cancels all actions of the last command.
577
578     \exception LockProtection This exception is raised, when trying to perform this command a study, which is protected for modifications.
579
580 <BR><VAR>See also <A href=exemple/Example16.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
581
582 */
583     void Undo() raises (LockProtection);
584 /*! \brief Redo method
585
586     Redoes all actions of the last 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 Redo() raises (LockProtection);
594 /*!
595     Returns True if at this moment there are any actions which can be canceled.
596     
597    <BR><VAR>See also <A href=exemple/Example16.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
598
599 */
600     boolean GetAvailableUndos();
601 /*!
602     Returns True if at this moment there are any actions which can be redone.
603
604    <BR><VAR>See also <A href=exemple/Example3.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
605
606 */
607     boolean GetAvailableRedos();
608 /*!
609     This method is called when adding an object into study.
610     It sets the callback for addition of the given %SObject.
611     \param theCallback New assigned callback.
612     \return The previous callback.
613 */
614     Callback SetOnAddSObject(in Callback theCallback);
615 /*!
616     This method is called when adding an object into study.
617     It sets the callback for removal of the given %SObject.
618
619     \return The previous callback.
620     \param theCallback New assigned callback.
621 */
622     Callback SetOnRemoveSObject(in Callback theCallback);
623
624 /*!
625     Puts name attribute with the given string value to the given %SObject
626
627     \param theSO Existing SObject to set name attribute.
628     \param theValue The value to be set to the name attribute.
629 */
630     void SetName(in SObject theSO, in string theValue) raises (LockProtection);
631
632 /*!
633     Puts comment attribute with the given string value to the given %SObject
634
635     \param theSO Existing SObject to set comment attribute.
636     \param theValue The value to be set to the comment attribute.
637 */
638     void SetComment(in SObject theSO, in string theValue) raises (LockProtection);
639
640 /*!
641     Puts IOR attribute with the given string value to the given %SObject
642
643     \param theSO Existing SObject to set IOR attribute.
644     \param theValue The value to be set to the IOR attribute.
645 */
646     void SetIOR(in SObject theSO, in string theValue) raises (LockProtection);
647   };
648
649   //==========================================================================
650 /*! \brief %Study Manager interface
651
652     The purpose of the Manager is to manipulate the %Studies. You will find in this
653     interface the methods to create, open,
654     close, and save a %Study. Since a %SALOME session is multi-document, you will
655     also find the methods allowing to navigate
656     through the collection of studies present in a session.
657 */
658   //==========================================================================
659
660   interface StudyManager
661   {
662 /*!
663     Determines whether the server has already been loaded or not.
664 */
665     void ping();
666
667 /*! \brief Creation of a new study
668
669      Creates a new study with a definite name.
670
671      \param study_name String parameter defining the name of the study
672
673 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
674
675 */
676     Study NewStudy(in string study_name);
677
678 /*! \brief Open a study
679
680      Reads and activates the structure of the study %Objects.
681      \param aStudyUrl The path to the study
682     \warning This method doesn't activate the corba objects. Only a component can do it.
683
684 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
685 */
686     Study Open (in URL aStudyUrl) raises (SALOME::SALOME_Exception);
687
688 /*! \brief Closing the study
689
690     Closes a study.
691 */
692     void  Close(in Study aStudy);
693 /*! \brief Saving the study in a HDF file (or files).
694
695     Saves a study.
696
697     \param theMultiFile If this parameter is True the study will be saved in several files.
698
699 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
700
701 */
702     void  Save(in  Study aStudy, in boolean theMultiFile);
703 /*! \brief Saving a study in a ASCII file (or files).
704
705     Saves a study in an ASCII format file (or files).
706     \param theMultiFile If this parameter is True the study will be saved in several files.
707 */
708     void  SaveASCII(in  Study aStudy, in boolean theMultiFile);
709 /*! \brief Saving the study in a specified HDF file (or files).
710
711     Saves the study in a specified file (or files).
712     \param aUrl The path to the definite file in whcih the study will be saved
713     \param aStudy The study which will be saved
714     \param theMultiFile If this parameter is True the study will be saved in several files.
715
716  <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
717 */
718     void  SaveAs(in URL   aUrl, // if the file already exists
719                 in Study aStudy,
720                 in boolean theMultiFile); // overwrite (as option)
721 /*! \brief Saving the study in a specified ASCII file (or files).
722
723     Saves the study in a specified ASCII file (or files).
724
725     \param aUrl The path to the definite file in whcih the study will be saved
726     \param aStudy The study which will be saved
727     \param theMultiFile If this parameter is True the study will be saved in several files.
728 */
729     void  SaveAsASCII(in URL   aUrl, // if the file already exists
730                       in Study aStudy,
731                       in boolean theMultiFile); // overwrite (as option)
732
733
734 /*! \brief List of open studies.
735
736 Gets the list of open studies
737
738     \return A list of open studies in the current session.
739 */
740     ListOfOpenStudies GetOpenStudies();
741
742 /*! \brief Getting a particular %Study picked by name
743
744     Activates a particular %Study
745     among the session collection picking it by name.
746     \param aStudyName The name of the study
747 */
748     Study GetStudyByName  (in string aStudyName);
749
750 /*! \brief Getting a particular %Study picked by ID
751
752     Activates a particular %Study
753     among the session collection picking it by ID.
754     \param aStudyID The ID of the study
755 */
756     Study GetStudyByID  (in short aStudyID);
757
758     // copy/paste methods
759
760 /*!
761     Returns True, if the given %SObject can be copied to the clipboard.
762 */
763     boolean CanCopy(in SObject theObject);
764 /*!
765     Returns True, if the given %SObject is copied to the clipboard.
766     \param theObject The %SObject which will be copied
767 */
768     boolean Copy(in SObject theObject);
769 /*!
770     Returns True, if the object from the clipboard can be pasted to the given %SObject.
771     \param theObject The %SObject stored in the clipboard.
772 */
773     boolean CanPaste(in SObject theObject);
774 /*!
775     Returns the %SObject in which the object from the clipboard was pasted to.
776     \param theObject The %SObject which will be pasted
777     \exception SALOMEDS::StudyBuilder::LockProtection This exception is raised, when trying to paste
778     an object into a study, which is protected for modifications.
779 */
780     SObject Paste(in SObject theObject) raises (SALOMEDS::StudyBuilder::LockProtection);
781   };
782
783
784   //==========================================================================
785 /*! \brief %SObject interface
786
787    The objects in the %study are built by the %StudyBuilder. The %SObject interface
788    provides methods for elementary inquiries, like getting an object %ID or its attribuites.
789  \note
790  
791    <BR><VAR>Tag</VAR> of an item in %SALOME application is an integer value uniquely defining an item
792    in the tree-type data structure.
793    <BR><VAR>ID</VAR> of an item is a description of item's position in the tree-type data structure.
794    ID is a list of tags and it has the following form: <TT>0:2:1:1</TT>.
795 */
796   //==========================================================================
797
798   interface SObject
799   {
800 /*! Name of the %SObject
801 */
802     attribute string Name; // equivalent to setName() & getName()
803 /*! Gets an object %ID
804
805    \return ID of the %SObject.
806 */
807     ID GetID();
808 /*!  Acquisition of the father %Component of the %SObject
809
810   \return The father %Component of the %SObject.
811 */
812     SComponent GetFatherComponent();
813 /*! Acquisition of the father %SObject of the %SObject
814
815    \return the father %SObject of the given %SObject.
816 */
817     SObject    GetFather();
818 /*! Gets the %tag of a %SObject
819
820     \return the %tag of a %SObject.
821 */
822     short      Tag();
823 /*! Gets the depth of a %SObject
824
825     \return the depth of a %SObject.
826 */
827     short      Depth();
828 /*! Looks for subobjects of a given %SObject.
829
830     \param atag Tag of the given %SObject
831     \return True if it finds a subobject of the %SObject with a definite tag as well as the required subobject.
832 */
833
834     boolean FindSubObject (in long atag, out SObject obj);
835 /*! Looks for attributes of a given %SObject
836
837    \param aTypeOfAttribute String value defining the type of the required attribute of the given %SObject.
838    \return True if it finds an attribute of a definite type of the given %SObject as well as the discovered attribute.
839
840 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
841 */
842     boolean FindAttribute(out GenericAttribute anAttribute,
843                                   in  string         aTypeOfAttribute);
844 /*! Looks for a %SObject which the given %SObject refers to.
845
846     \return The object which the given %SObject refers to as well as True if it finds
847     this object.
848 */
849     boolean ReferencedObject(out SObject obj); // A REVOIR
850 /*! Gets all attributes of a given %SObject
851
852     \return The list of all attributes of the given %SObject.
853
854 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
855
856 */
857     ListOfAttributes     GetAllAttributes();
858 /*! Gets the study of a given %SObject.
859
860     /return The study containing the given %SObject.
861 */
862     Study GetStudy();
863
864 /*! Gets the CORBA object by its own IOR attribute.
865     Returns nil, if can't.
866
867     /return The CORBA object of the %SObject.
868 */
869     Object GetObject();
870
871 /*!
872     Returns the name attribute value of this SObject.
873     Returns empty string if there is no name attribute.
874 */
875     string GetName();
876
877 /*!
878     Returns the comment attribute value of this SObject.
879     Returns empty string if there is no comment attribute.
880 */
881     string GetComment();
882
883 /*!
884     Returns the IOR attribute value of this SObject.
885     Returns empty string if there is no IOR attribute.
886 */
887     string GetIOR();
888   };
889
890
891   //==========================================================================
892 /*! \brief %Generic attribute interface
893
894    %Generic attribute is a base interface for all attributes which can be assigned to the SObjects created in the study.
895 */
896   //==========================================================================
897   interface GenericAttribute
898   {
899 /*! \brief Exception locking all changes
900
901     This exception locks all modifications in attributes.
902 */
903     exception LockProtection {};
904 /*! \brief Method CheckLocked
905
906    Checks whether the %Study is protected for modifications.
907
908    \note <BR>This exception is raised only outside a transaction.
909 */
910     void CheckLocked() raises (LockProtection);
911
912     string Store();
913
914     void Restore(in string theData);
915
916     string Type();
917
918     SObject GetSObject();
919   };
920
921
922
923   //==========================================================================
924 /*! \brief %SComponent interface
925
926    The %SComponent interface establishes in the study a permanent assocition to the Components integrated into %SALOME platform.
927    The %SComponent interface is a specialization of the %SObject interface.
928    It inherits the most of its methods from the %SObject interface.
929 */
930   //==========================================================================
931   interface SComponent : SObject
932   {
933 /*! Gets the data type of the given %SComponent
934
935     \return The data type of this %SComponent.
936 */
937     string  ComponentDataType();
938 /*! Gets the IOR of the given component
939
940   \return True (if there is an instance of the given component) and its IOR.
941 */
942     boolean ComponentIOR (out ID theID); //returns True if there is an instance
943                                          //In this case ID identifies this one
944   };
945
946
947   //==========================================================================
948 /*! \brief %SComponentIterator interface
949
950   This interface contains the methods allowing to iterate over all components in the list.
951   The search is started from the first %SComponent in the list.
952 */
953   //==========================================================================
954   interface SComponentIterator
955   {
956 /*!
957 Activates the %SComponentIterator.
958 */
959     void Init();
960 /*!  Method More
961
962    \return True if there is one more %SComponent in the list.
963 */
964     boolean More();
965 /*!
966 Moves the iterator to the next %SComponent in the list.
967 */
968     void Next();
969 /*!
970     Returns the %SComponent corresponding to the current %SComponent found by the iterator.
971
972  <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
973
974 */
975     SComponent Value();
976   };
977
978   //==========================================================================
979 /*! \brief %ChildIterator interface
980
981     This interface contains methods which allow to iterate over all child
982     levels.
983 */
984   //==========================================================================
985   interface ChildIterator
986   {
987 /*!
988
989 Activates the %ChildIterator.
990 */
991     void Init();
992 /*!
993
994 Activates the %ChildIterator for all child levels.
995
996 \param allLevels If this boolean parameter is True, the %ChildIterator will be activated for all child levels.
997 */
998     void InitEx(in boolean allLevels);
999 /*! Method More
1000
1001    \return True if there is one more %ChildIterator in the list.
1002 */
1003     boolean More();
1004 /*!
1005     Passes the iterator to the next level.
1006 */
1007     void Next();
1008 /*!
1009     Returns the %SObject corresponding to the current object found by the iterator.
1010 */
1011     SObject Value();
1012   };
1013
1014   //==========================================================================
1015   //==========================================================================
1016 /*! \brief Interface of the %UseCaseIterator.
1017
1018    This interface contains a set of methods used for iteration over the objects in the use case.
1019 */
1020   interface UseCaseIterator
1021   {
1022 /*!
1023 Activates the %UseCaseIterator.
1024 \param allLevels If the value of this parameter is True the Iterator is activated for all subobjects.
1025 */
1026     void Init(in boolean allLevels);
1027 /*! Method More
1028
1029     \return True if the %UseCaseIterator finds one more object.
1030 */
1031     boolean More();
1032 /*!
1033     Passes the iterator to the next object.
1034 */
1035     void Next();
1036 /*!
1037     Returns the %SObject corresponding to the current object found by the Iterator.
1038 */
1039     SObject Value();
1040   };
1041
1042   //==========================================================================
1043   //==========================================================================
1044 /*! \brief Interface of the %UseCaseBuilder
1045
1046    Use case in the study represents a user-managed subtree, containing all or some of the objects which exist in the study.
1047    The %UseCaseBuilder interface contains a set of methods used for management of the use case in the study.
1048 */
1049   interface UseCaseBuilder
1050   {
1051 /*!
1052    Adds to the use case an object as a child of the current object of the use case.
1053
1054    \param theObject The added %SObject.
1055    \return True if this %SObject has been added in the use case.
1056 */
1057     boolean Append(in SObject theObject);
1058 /*!
1059    Removes an object from the use case.
1060
1061    \param theObject The deleted %SObject
1062    \return True if this %SObject has been deleted from the use case.
1063 */
1064     boolean Remove(in SObject theObject);
1065 /*!
1066    Adds a child object <VAR>theObject</VAR> to the given father <VAR>theFather</VAR> object in the use case.
1067 */
1068     boolean AppendTo(in SObject theFather, in SObject theObject);
1069 /*!
1070     Inserts in the use case the object <VAR>theFirst</VAR> before the object <VAR>theNext</VAR>.
1071 */
1072     boolean InsertBefore(in SObject theFirst, in SObject theNext);
1073 /*!
1074     Sets the current object of the use case.
1075 */
1076     boolean SetCurrentObject(in SObject theObject);
1077 /*!
1078     Makes the root object to be the current object of the use case.
1079 */
1080     boolean SetRootCurrent();
1081 /*!
1082    Returns True if the given object <VAR>theObject</VAR> of the use case has child objects.
1083 */
1084     boolean HasChildren(in SObject theObject);
1085 /*!
1086    Sets the name of the use case.
1087 */
1088     boolean SetName(in string theName);
1089 /*!
1090    Gets the name of the use case.
1091 */
1092     string GetName();
1093 /*!
1094    Returns True if the given object <VAR>theObject</VAR> represents a use case.
1095 */
1096     boolean IsUseCase(in SObject theObject);
1097 /*!
1098     Gets the current object of the use case.
1099 */
1100     SObject GetCurrentObject();
1101 /*!
1102     Creates a new use case in the use case browser.
1103 */
1104     SObject AddUseCase(in string theName);
1105 /*!
1106     Returns the %UseCaseIterator for the given object <VAR>theObject</VAR> in the use case.
1107 */
1108     UseCaseIterator GetUseCaseIterator(in SObject theObject);
1109   };
1110   //==========================================================================
1111   //==========================================================================
1112 /*! \brief The callback interface
1113
1114   The %StudyBuilder can be created with the method <VAR>NewBuilder</VAR>. While invocation of this method a new object of the class <VAR>Callback</VAR> is created
1115   and this object is assigned to the newly created Builder as callback which should be called when adding and removing of the ojects.
1116 */
1117   interface Callback
1118   {
1119 /*!
1120      Invokes the corresponding method <VAR>Append</VAR> of the %UseCaseBuilder.
1121 */
1122      void OnAddSObject(in SObject theObject);
1123 /*!
1124      Invokes the corresponding method <VAR>Remove</VAR> of the %UseCaseBuilder.
1125 */
1126      void OnRemoveSObject(in SObject theObject);
1127   };
1128
1129   //==========================================================================
1130 /*! \brief %Driver interface
1131
1132 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
1133 can be called by any component and which provide the following functionality:
1134 <ul>
1135     <li> publishing in the study of the objects created by a definite component
1136     <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.
1137     <li> transforming of the transient references into persistant references (or vice versa) of the SObjects when saving (or loading) a study
1138     <li> copy/paste common functionality. These methods can be called by any component in order to copy/paste its object created in the study
1139 </ul>
1140
1141 */
1142   //==========================================================================
1143   interface Driver
1144   {
1145
1146     /*! \brief Saving the data produced by a definite component.
1147
1148         This method is called by the StudyManager when saving a study.
1149        \param theComponent    %SComponent corresponding to this Component
1150        \param theURL  The path to the file in which the data will be saved.
1151        \param isMultiFile  If the value of this boolean parameter is True, the data will be saved in several files.
1152        \return A byte stream TMPFile that contains all saved data
1153
1154 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
1155
1156      */
1157
1158
1159     TMPFile Save(in SComponent theComponent, in string theURL, in boolean isMultiFile);
1160
1161 /*! \brief Saving the data in ASCII format produced by a definite component.
1162
1163         This method is called by the StudyManager when saving a study in ASCII format.
1164        \param theComponent    %SComponent corresponding to this Component
1165        \param theURL  The path to the file in which the data will be saved.
1166        \param isMultiFile  If the value of this boolean parameter is True, the data will be saved in several files.
1167        \return A byte stream TMPFile that will contain all saved data
1168
1169 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
1170
1171      */
1172     TMPFile SaveASCII(in SComponent theComponent, in string theURL, in boolean isMultiFile);
1173
1174     /*! \brief Loading the data.
1175
1176        This method is called by the StudyManager when opening a study.
1177        \param theComponent      %SComponent corresponding to this Component
1178        \param theStream   The file which contains all data saved by the component on Save method
1179        \param isMultiFile  If the value of this boolean parameter is True, the data will be loaded from several files
1180
1181      */
1182
1183     boolean Load(in SComponent theComponent, in TMPFile theStream, in string theURL, in boolean isMultiFile);
1184
1185     /*! \brief Loading the data from files in ASCII format.
1186
1187        This method is called by the StudyManager when opening a study.
1188        \param theComponent      %SComponent corresponding to this Component
1189        \param theStream   The file which contains all data saved by the component on Save method
1190        \param isMultiFile  If the value of this boolean parameter is True, the data will be loaded from several files
1191
1192      */
1193
1194     boolean LoadASCII(in SComponent theComponent, in TMPFile theStream, in string theURL, in boolean isMultiFile);
1195
1196     /*! \brief Closing of the study
1197
1198       This method Close is called by the StudyManager when closing a study.
1199     \param aSComponent The according %SComponent
1200      */
1201
1202     void Close (in SComponent aSComponent);
1203     //void Close ( in string  aIORSComponent);
1204
1205     /*! Gets the type of the data
1206
1207         \return The type of data produced by the Component in the study.
1208      */
1209
1210      string ComponentDataType();
1211
1212     // Driver Transient -> persistent called for each object in study
1213 /*!
1214    Transforms IOR of a given %SObject into PersistentID. It is called for each
1215    object in the %study.
1216 \note <br> In %SALOME the objects which are present in an active study are identified by an IOR, when this
1217 study is saved these references are transformed into persintent IDs.
1218
1219    \param theSObject The given %SObject.
1220    \param IORString The IOR of the given %SObject.
1221    \param isMultiFile If this parameter is True the study containing the given %SObject is stored in several files.
1222    \param isASCII If this parameter is True the study containing the given %SObject is stored in ASCII format.
1223
1224    \return The persistent ID of the given %SObject
1225
1226 */
1227     string IORToLocalPersistentID (in SObject theSObject,
1228                                    in string IORString,
1229                                    in boolean isMultiFile,
1230                                    in boolean isASCII);
1231 /*!
1232   Transforms PersistentID into IOR of the object. It is called for each
1233    object in the %study.
1234
1235    \note <br> In %SALOME the objects which are present in an saved study (file) are identified by a persistent ID, when this
1236 study is open, these references are transformed into persintent IORs.
1237
1238    \param theSObject The given %SObject.
1239    \param IORString The IOR of the given %SObject.
1240    \param isMultiFile If this parameter is True the study containing the given %SObject is stored in several files.
1241    \param isASCII If this parameter is True the study containing the given %SObject is stored in ASCII format.
1242
1243    \return The IOR of the given %SObject
1244
1245 */
1246     string LocalPersistentIDToIOR (in SObject theSObject,
1247                                    in string aLocalPersistentID,
1248                                    in boolean isMultiFile,
1249                                    in boolean isASCII)
1250       raises (SALOME::SALOME_Exception);
1251
1252     // Publishing in the study
1253 /*! Publishing in the study
1254
1255     \return True if the given %Component can publish a definite object with a given IOR in the %study.
1256     \param theIOR The IOR of a definite object
1257 */
1258     boolean CanPublishInStudy(in Object theIOR) raises (SALOME::SALOME_Exception);
1259 /*! \brief Publishing in the study
1260
1261    Publishes the given object in the %study, using the algorithm of this component.
1262     \param theStudy     The %study in which the object is published
1263     \param theSObject     If this parameter is null the object is published for the first time. Otherwise
1264     this parameter should contain a reference to the object published earlier
1265     \param theObject      The object which is published
1266     \param theName      The name of the published object. If this parameter is empty, the name is generated
1267     automatically by the component.
1268
1269     \return The published %SObject.
1270 */
1271     SObject PublishInStudy(in Study theStudy, in SObject theSObject, in Object theObject, in string theName);
1272
1273     // copy/paste methods
1274
1275 /*!
1276     Returns True, if the given %SObject can be copied to the clipboard.
1277
1278     \param theObject The given %SObject which should be copied.
1279 */
1280     boolean CanCopy(in SObject theObject);
1281 /*!
1282     Returns the object %ID and the %TMPFile of the object from the given %SObject.
1283 */
1284     TMPFile CopyFrom(in SObject theObject, out long theObjectID);
1285 /*!
1286     Returns True, if the component can paste the object with given %ID of the component with name <VAR>theComponentName</VAR>.
1287 */
1288     boolean CanPaste(in string theComponentName, in long theObjectID);
1289 /*!
1290     Returns the %SObject of the pasted object.
1291 */
1292     SObject PasteInto(in TMPFile theStream, in long theObjectID, in SObject theObject);
1293
1294   };
1295 };
1296
1297 #endif