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