Salome HOME
updated copyright message
[modules/kernel.git] / idl / SALOMEDS.idl
1 // Copyright (C) 2007-2023  CEA, EDF, 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 Check if study can be opened
578
579     Tries to open and read given url.
580     \param aStudyUrl The path to the study
581 */
582     boolean CanOpen (in URLPath aStudyUrl);
583
584 /*! \brief Saving the study in a file (or files).
585
586     Saves a study.
587     \param theMultiFile If this parameter is True the study will be saved in several files.
588     \param theASCII If this parameter is True the study will be saved in ASCII format, otherwise in HDF format.
589 */
590     boolean Save(in boolean theMultiFile, in boolean theASCII) raises(StudyInvalidReference);
591
592 /*! \brief Saving the study in a specified file (or files).
593
594     Saves the study in a specified file (or files).
595     \param aUrl The path to the definite file in which the study will be saved
596     \param theMultiFile If this parameter is True the study will be saved in several files.
597     \param theASCII If this parameter is True the study will be saved in ASCII format, otherwise in HDF format.
598
599 <em>See \ref example1 for an example of this method usage in batchmode of %SALOME application.</em>
600 */
601     boolean  SaveAs(in URLPath aUrl, // if the file already exists
602                     in boolean theMultiFile, // overwrite (as option)
603                     in boolean theASCII)
604                     raises(StudyInvalidReference);
605 /*!
606     Returns True, if the given %SObject can be copied to the clipboard.
607 */
608     boolean CanCopy(in SObject theObject) raises(StudyInvalidReference);
609 /*!
610     Returns True, if the given %SObject is copied to the clipboard.
611     \param theObject The %SObject which will be copied
612 */
613     boolean Copy(in SObject theObject) raises(StudyInvalidReference);
614 /*!
615     Returns True, if the object from the clipboard can be pasted to the given %SObject.
616     \param theObject The %SObject stored in the clipboard.
617 */
618     boolean CanPaste(in SObject theObject) raises(StudyInvalidReference);
619 /*!
620     Returns the %SObject in which the object from the clipboard was pasted to.
621     \param theObject The %SObject which will be pasted
622     \exception SALOMEDS::StudyBuilder::LockProtection This exception is raised, when trying to paste
623     an object into a study, which is protected for modifications.
624 */
625     SObject Paste(in SObject theObject) raises (SALOMEDS::StudyBuilder::LockProtection);
626
627 /*! \brief  Enable (if isEnabled = True)/disable automatic addition of new %SObjects to the use case.
628 */
629     void EnableUseCaseAutoFilling(in boolean isEnabled) raises(StudyInvalidReference);
630
631 /*!
632     Functions for internal usage only
633 */
634     void AddPostponed(in string theIOR) raises(StudyInvalidReference);
635
636     void AddCreatedPostponed(in string theIOR) raises(StudyInvalidReference);
637
638     void RemovePostponed(in long theUndoLimit) raises(StudyInvalidReference);
639
640     void UndoPostponed(in long theWay) raises(StudyInvalidReference);
641
642     boolean DumpStudy(in string thePath,
643                       in string theBaseName,
644                       in boolean isPublished,
645                       in boolean isMultiFile) raises(StudyInvalidReference);
646
647 /*! \brief  Returns the folder of the python script which is currently dumped.
648 */
649     string GetDumpPath();
650
651 /*! \brief  Get an AttributeParameter used to store common parameters for given %theSavePoint.
652
653     \param theID identifies a common parameters set (Example: "Interface Applicative")
654     \param theSavePoint is number of a set of parameters as there can be several sets
655 */
656     AttributeParameter GetCommonParameters(in string theID, in long theSavePoint) raises(StudyInvalidReference);
657
658 /*! \brief  Get an AttributeParameter used to store parameters for given %theModuleName.
659
660     \param theID identifies a common parameters set (Example: "Interface Applicative")
661     \param theModuleName is a name of the module (Example: "Geometry")
662     \param theSavePoint is number of a set of parameters as there can be several sets
663 */
664     AttributeParameter GetModuleParameters(in string theID, in string theModuleName, in long theSavePoint) raises(StudyInvalidReference);
665
666
667 /*! \brief Get a default Python script to restore visual parameters for given %theModuleName.
668
669     \param theModuleName is a name of the module (Example: "Geometry")
670     \param indent is a string to use for script indentation
671 */
672     string GetDefaultScript(in string theModuleName, in string indent) raises(StudyInvalidReference);
673
674 /*!
675     Private method, returns an implementation of this Study.
676    \param theHostname is a hostname of the caller
677    \param thePID is a process ID of the caller
678    \param isLocal is set True if the Study is launched locally with the caller
679 */
680     long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal);
681
682
683 /*! \brief  Mark this Study as being locked by the given locker.
684
685     The lock status can be checked by method IsStudyLocked
686     \param theLockerID identifies a locker of the study can be for ex. IOR of the engine that locks the study.
687 */
688     void SetStudyLock(in string theLockerID) raises(StudyInvalidReference);
689
690 /*! \brief Indicate if the Study is locked
691
692    Returns True if the Study was marked locked.
693 */
694     boolean IsStudyLocked() raises(StudyInvalidReference);
695
696 /*! \brief  Mark this Study as being unlocked by the given locker.
697
698      The lock status can be checked by method IsStudyLocked
699     \param theLockerID identifies a locker of the study can be for ex. IOR of the engine that unlocks the study.
700 */
701     void UnLockStudy(in string theLockerID) raises(StudyInvalidReference);
702
703 /*! \brief  Get the list of IDs of the Study's lockers.
704 */
705     ListOfStrings GetLockerID() raises(StudyInvalidReference);
706
707 /*! \brief  Create real variable with Name theVarName and value theValue
708
709     (or set if variable value into theValue already exists)
710     \param theVarName is a name of the variable
711     \param theVarName is a value of the variable.
712 */
713     void SetReal( in string theVarName, in double theValue ) raises(StudyInvalidReference);
714
715 /*! \brief  Create integer variable with Name theVarName and value theValue
716
717     (or set if variable value into theValue already exists)
718     \param theVarName is a name of the variable
719     \param theVarName is a value of the variable.
720 */
721     void SetInteger( in string theVarName, in long theValue ) raises(StudyInvalidReference);
722 /*! \brief  Create boolean variable with Name theVarName and value theValue
723
724     (or set if variable value into theValue already exists)
725     \param theVarName is a name of the variable
726     \param theVarName is a value of the variable.
727 */
728     void SetBoolean( in string theVarName, in boolean theValue ) raises(StudyInvalidReference);
729
730 /*! \brief  Create string variable with Name theVarName and value theValue
731
732     (or set if variable value into theValue already exists)
733     \param theVarName is a name of the variable
734     \param theVarName is a value of the variable.
735 */
736     void SetString( in string theVarName, in string theValue ) raises(StudyInvalidReference);
737
738 /*! \brief  Set current value as double for string variable
739 */
740     void SetStringAsDouble( in string theVarName, in double theValue ) raises(StudyInvalidReference);
741
742 /*! \brief Get value of a real variable
743
744     \param theVarName is a name of the variable.
745 */
746     double GetReal( in string theVarName ) raises(StudyInvalidReference);
747
748 /*! \brief Get value of an integer variable
749
750     \param theVarName is a name of the variable.
751 */
752     long GetInteger( in string theVarName ) raises(StudyInvalidReference);
753
754 /*! \brief Get value of a boolean variable
755
756     \param theVarName is a name of the variable.
757 */
758     boolean GetBoolean( in string theVarName ) raises(StudyInvalidReference);
759
760 /*! \brief Get value of a string variable
761
762     \param theVarName is a name of the variable.
763 */
764     string GetString( in string theVarName ) raises(StudyInvalidReference);
765
766
767 /*! \brief Indicate if a variable is real
768
769     Return true if variable is real otherwise return false.
770     \param theVarName is a name of the variable.
771 */
772     boolean IsReal( in string theVarName ) raises(StudyInvalidReference);
773
774 /*! \brief Indicate if a variable is integer
775
776     Return true if variable is integer otherwise return false.
777     \param theVarName is a name of the variable.
778 */
779     boolean IsInteger( in string theVarName ) raises(StudyInvalidReference);
780
781 /*! \brief Indicate if a variable is boolean
782
783     Return true if variable is boolean otherwise return false.
784     \param theVarName is a name of the variable.
785 */
786     boolean IsBoolean( in string theVarName ) raises(StudyInvalidReference);
787
788 /*! \brief Indicate if a variable is string
789
790     Return true if variable is string otherwise return false.
791     \param theVarName is a name of the variable.
792 */
793     boolean IsString( in string theVarName ) raises(StudyInvalidReference);
794
795 /*! \brief Indicate if a variable exists in the study
796
797     Return true if variable exists in the study,
798     otherwise return false.
799     \param theVarName is a name of the variable.
800 */
801     boolean IsVariable( in string theVarName ) raises(StudyInvalidReference);
802
803 /*! \brief Get names of all variables from the study.
804 */
805     ListOfStrings GetVariableNames() raises(StudyInvalidReference);
806
807 /*! \brief Remove a variable
808
809    Remove variable with the specified name from the study with substitution of its value.
810
811    \param theVarName Name of the variable.
812    \return Status of operation.
813 */
814     boolean RemoveVariable( in string theVarName ) raises(StudyInvalidReference);
815
816 /*! \brief Rename a variable
817
818    Rename variable with the specified name within the study.
819
820    \param theVarName Name of the variable.
821    \param theNewVarName New name for the variable.
822    \return Status of operation.
823 */
824     boolean RenameVariable( in string theVarName, in string theNewVarName ) raises(StudyInvalidReference);
825
826 /*! \brief Indicate whether variable is used
827
828    Check that variable is used in the study.
829
830    \param theVarName Name of the variable.
831    \return Variable usage.
832 */
833     boolean IsVariableUsed( in string theVarName ) raises(StudyInvalidReference);
834
835 /*! \brief Parse variables used for object creation
836
837    \param string with variables, separated by special symbol.
838    \return Variables list.
839 */
840     ListOfListOfStrings ParseVariables( in string theVars ) raises(StudyInvalidReference);
841
842 /*!
843      Attach an observer to the Study
844
845     \param theObserver observer being attached
846     \param modify when \c true, observer receives any object's modification events;
847            otherwise observer receives object's creation events only
848 */
849      void attach(in SALOMEDS::Observer theObserver, in boolean modify);
850 /*!
851      Detach an observer from the Study
852
853     \param theObserver observer to be detached
854 */
855      void detach(in SALOMEDS::Observer theObserver);
856   };
857
858   //==========================================================================
859 /*! \brief %SObject interface
860
861    The objects in the %study are built by the %StudyBuilder. The %SObject interface
862    provides methods for elementary inquiries, like getting an object %ID or its attribuites.
863  \note
864
865    <BR><VAR>Tag</VAR> of an item in %SALOME application is an integer value uniquely defining an item
866    in the tree-type data structure.
867    <BR><VAR>ID</VAR> of an item is a description of item's position in the tree-type data structure.
868    ID is a list of tags and it has the following form: <TT>0:2:1:1</TT>.
869 */
870   //==========================================================================
871
872   interface SObject : SALOME::GenericObj
873   {
874 /*! Name of the %SObject
875 */
876     attribute string Name; // equivalent to setName() & getName()
877
878 /*! Returns true if the %SObject does not belong to any %Study
879 */
880     boolean IsNull();
881
882 /*! Gets an object %ID
883    \return ID of the %SObject.
884 */
885     ID GetID();
886
887 /*!  Acquisition of the father %Component of the %SObject
888   \return The father %Component of the %SObject.
889 */
890     SComponent GetFatherComponent();
891
892 /*! Acquisition of the father %SObject of the %SObject
893    \return the father %SObject of the given %SObject.
894 */
895     SObject    GetFather();
896
897 /*! Gets the %tag of a %SObject
898     \return the %tag of a %SObject.
899 */
900     short      Tag();
901
902 /*! Returns a tag of the last child %SObject (if any) of this %SObject.
903     Returns zero if this %SObject has no children.
904 */
905     short      GetLastChildTag();
906
907 /*! Gets the depth of a %SObject
908     \return the depth of a %SObject.
909 */
910     short      Depth();
911
912 /*! Looks for subobjects of a given %SObject.
913     \param atag Tag of the given %SObject
914     \return True if it finds a subobject of the %SObject with a definite tag as well as the required subobject.
915 */
916     boolean FindSubObject (in long atag, out SObject obj);
917
918 /*! Looks for attributes of a given %SObject
919    \param aTypeOfAttribute String value defining the type of the required attribute of the given %SObject.
920    \return True if it finds an attribute of a definite type of the given %SObject as well as the discovered attribute.
921
922 <em>See \ref example1 for an example of this method usage in batchmode of %SALOME application.</em>
923 */
924     boolean FindAttribute(out GenericAttribute anAttribute,
925                                   in  string         aTypeOfAttribute);
926
927 /*! Looks for a %SObject which the given %SObject refers to.
928     \return The object which the given %SObject refers to as well as True if it finds
929     this object.
930 */
931     boolean ReferencedObject(out SObject obj); // A REVOIR
932
933 /*! Gets all attributes of a given %SObject
934     \return The list of all attributes of the given %SObject.
935
936 <em>See \ref example17 for an example of this method usage in batchmode of %SALOME application.</em>
937
938 */
939     ListOfAttributes     GetAllAttributes();
940
941 /*! Gets the CORBA object by its own IOR attribute.
942     Returns nil, if can't.
943     \return The CORBA object of the %SObject.
944 */
945     Object GetObject();
946
947 /*!
948     Returns the name attribute value of this SObject.
949     Returns empty string if there is no name attribute.
950 */
951     string GetName();
952
953 /*!
954     Returns the comment attribute value of this SObject.
955     Returns empty string if there is no comment attribute.
956 */
957     string GetComment();
958
959 /*!
960     Returns the IOR attribute value of this SObject.
961     Returns empty string if there is no IOR attribute.
962 */
963     string GetIOR();
964
965 /*!
966     Set an attribute value (of type string)
967    \param name the name of the attribute
968    \param value the value of the attribute
969 */
970     void SetAttrString(in string name, in string value);
971
972 /*!
973     Private method, returns an implementation of this SObject.
974    \param theHostname is a hostname of the caller
975    \param thePID is a process ID of the caller
976    \param isLocal is set True if the SObject is launched locally with the caller
977 */
978     long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal);
979   };
980
981
982   //==========================================================================
983 /*! \brief %Generic attribute interface
984
985    %Generic attribute is a base interface for all attributes which can be assigned to the SObjects created in the study.
986 */
987   //==========================================================================
988   interface GenericAttribute : SALOME::GenericObj
989   {
990 /*! \brief Exception locking all changes
991
992     This exception locks all modifications in attributes.
993 */
994     exception LockProtection {};
995 /*! \brief Method CheckLocked
996
997    Checks whether the %Study is protected for modifications.
998
999    \note <BR>This exception is raised only outside a transaction.
1000 */
1001     void CheckLocked() raises (LockProtection);
1002
1003     //! Get Type
1004     string Type();
1005
1006     //! Get the class type
1007     string GetClassType();
1008
1009     //! Get SObject
1010     SObject GetSObject();
1011
1012   //!  Private method, returns an implementation of this GenericAttribute.
1013 /*!
1014    \param theHostname is a hostname of the caller
1015    \param thePID is a process ID of the caller
1016    \param isLocal is set True if the GenericAttribute is launched locally with the caller
1017 */
1018     long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal);
1019   };
1020
1021
1022
1023   //==========================================================================
1024 /*! \brief %SComponent interface
1025
1026    The %SComponent interface establishes in the study a permanent assocition to the Components integrated into %SALOME platform.
1027    The %SComponent interface is a specialization of the %SObject interface.
1028    It inherits the most of its methods from the %SObject interface.
1029 */
1030   //==========================================================================
1031   interface SComponent : SObject
1032   {
1033 /*! \brief Gets the data type of the given %SComponent
1034
1035     \return The data type of this %SComponent.
1036 */
1037     string  ComponentDataType();
1038 /*! \brief Gets the IOR of the given component
1039
1040   \return True (if there is an instance of the given component) and its IOR.
1041 */
1042     boolean ComponentIOR (out ID theID); //returns True if there is an instance
1043                                          //In this case ID identifies this one
1044   };
1045
1046
1047   //==========================================================================
1048 /*! \brief %SComponentIterator interface
1049
1050   This interface contains the methods allowing to iterate over all components in the list.
1051   The search is started from the first %SComponent in the list.
1052 */
1053   //==========================================================================
1054   interface SComponentIterator : SALOME::GenericObj
1055   {
1056 /*!
1057 \brief Activates the %SComponentIterator.
1058 */
1059     void Init();
1060 /*!  \brief Method More
1061
1062    \return True if there is one more %SComponent in the list.
1063 */
1064     boolean More();
1065 /*!
1066 \brief Moves the iterator to the next %SComponent in the list.
1067 */
1068     void Next();
1069 /*!
1070     \brief Returns the %SComponent corresponding to the current %SComponent found by the iterator.
1071
1072 <em>See \ref example1 for an example of this method usage in batchmode of %SALOME application.</em>
1073
1074 */
1075     SComponent Value();
1076   };
1077
1078   //==========================================================================
1079 /*! \brief %ChildIterator interface
1080
1081     This interface contains methods which allow to iterate over all child
1082     levels.
1083 */
1084   //==========================================================================
1085   interface ChildIterator : SALOME::GenericObj
1086   {
1087 /*!
1088
1089 \brief Activates the %ChildIterator.
1090 */
1091     void Init();
1092 /*!
1093
1094 \brief Activates the %ChildIterator for all child levels.
1095
1096 \param allLevels If this boolean parameter is True, the %ChildIterator will be activated for all child levels.
1097 */
1098     void InitEx(in boolean allLevels);
1099 /*! \brief Method More
1100
1101    \return True if there is one more %ChildIterator in the list.
1102 */
1103     boolean More();
1104 /*!
1105     \brief Passes the iterator to the next level.
1106 */
1107     void Next();
1108 /*!
1109     \brief Returns the %SObject corresponding to the current object found by the iterator.
1110 */
1111     SObject Value();
1112   };
1113
1114   //==========================================================================
1115   //==========================================================================
1116 /*! \brief Interface of the %UseCaseIterator.
1117
1118    This interface contains a set of methods used for iteration over the objects in the use case.
1119 */
1120   interface UseCaseIterator : SALOME::GenericObj
1121   {
1122 /*!
1123 Activates the %UseCaseIterator.
1124 \param allLevels If the value of this parameter is True the Iterator is activated for all subobjects.
1125 */
1126     void Init(in boolean allLevels);
1127 /*! Method More
1128
1129     \return True if the %UseCaseIterator finds one more object.
1130 */
1131     boolean More();
1132 /*!
1133     Passes the iterator to the next object.
1134 */
1135     void Next();
1136 /*!
1137     Returns the %SObject corresponding to the current object found by the Iterator.
1138 */
1139     SObject Value();
1140   };
1141
1142   //==========================================================================
1143   //==========================================================================
1144 /*! \brief Interface of the %UseCaseBuilder
1145
1146    Use case in the study represents a user-managed subtree, containing all or some of the objects which exist in the study.
1147    The %UseCaseBuilder interface contains a set of methods used for management of the use case in the study.
1148 */
1149   interface UseCaseBuilder : SALOME::GenericObj
1150   {
1151 /*!
1152    Adds to the use case an object as a child of the current object of the use case.
1153
1154    \param theObject The added %SObject.
1155    \return True if this %SObject has been added in the use case.
1156 */
1157     boolean Append(in SObject theObject);
1158 /*!
1159    Removes an object from the use case.
1160
1161    \param theObject The deleted %SObject
1162    \return True if this %SObject has been deleted from the use case.
1163 */
1164     boolean Remove(in SObject theObject);
1165 /*!
1166    Adds a child object <VAR>theObject</VAR> to the given father <VAR>theFather</VAR> object in the use case.
1167 */
1168     boolean AppendTo(in SObject theFather, in SObject theObject);
1169 /*!
1170     Return index of a child among father children
1171 */
1172     long GetIndexInFather(in SObject theFather, in SObject theObject);
1173 /*!
1174     Inserts in the use case the object <VAR>theFirst</VAR> before the object <VAR>theNext</VAR>.
1175 */
1176     boolean InsertBefore(in SObject theFirst, in SObject theNext);
1177 /*!
1178     Sets the current object of the use case.
1179 */
1180     boolean SetCurrentObject(in SObject theObject);
1181 /*!
1182     Makes the root object to be the current object of the use case.
1183 */
1184     boolean SetRootCurrent();
1185 /*!
1186    Returns True if the given object <VAR>theObject</VAR> of the use case has child objects.
1187 */
1188     boolean HasChildren(in SObject theObject);
1189 /*!
1190    Returns True if children of the given object <VAR>theObject</VAR> of the use case tree were sorted successfully.
1191 */
1192     boolean SortChildren(in SObject theObject, in boolean theAscendingOrder);
1193 /*!
1194    Gets father object of the given object <VAR>theObject</VAR> in the use cases tree.
1195 */
1196     SObject GetFather(in SObject theObject);
1197 /*!
1198    Sets the name of the use case.
1199 */
1200     boolean SetName(in string theName);
1201 /*!
1202    Gets the name of the use case.
1203 */
1204     string GetName();
1205 /*!
1206    Returns True if the given object <VAR>theObject</VAR> represents a use case.
1207 */
1208     boolean IsUseCase(in SObject theObject);
1209 /*!
1210    Returns True if the given object <VAR>theObject</VAR> is included in the use cases tree on any level.
1211 */
1212     boolean IsUseCaseNode(in SObject theObject);
1213 /*!
1214     Gets the current object of the use case.
1215 */
1216     SObject GetCurrentObject();
1217 /*!
1218     Creates a new use case in the use case browser.
1219 */
1220     SObject AddUseCase(in string theName);
1221 /*!
1222     Returns the %UseCaseIterator for the given object <VAR>theObject</VAR> in the use case.
1223 */
1224     UseCaseIterator GetUseCaseIterator(in SObject theObject);
1225   };
1226   //==========================================================================
1227 /*! \brief %Driver interface
1228
1229 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
1230 can be called by any component and which provide the following functionality:
1231 <ul>
1232     <li> publishing in the study of the objects created by a definite component
1233     <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.
1234     <li> transforming of the transient references into persistent references (or vice versa) of the SObjects when saving (or loading) a study
1235     <li> copy/paste common functionality. These methods can be called by any component in order to copy/paste its object created in the study
1236 </ul>
1237
1238 */
1239   //==========================================================================
1240   interface Driver
1241   {
1242
1243     /*! \brief Saving the data produced by a definite component.
1244
1245         This method is called when saving a study.
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 contains 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
1255
1256     TMPFile Save(in SComponent theComponent, in string theURL, in boolean isMultiFile);
1257
1258 /*! \brief Saving the data in ASCII format produced by a definite component.
1259
1260         This method is called when saving a study in ASCII format.
1261        \param theComponent    %SComponent corresponding to this Component
1262        \param theURL  The path to the file in which the data will be saved.
1263        \param isMultiFile  If the value of this boolean parameter is True, the data will be saved in several files.
1264        \return A byte stream TMPFile that will contain all saved data
1265
1266 <em>See \ref example19 for an example of this method usage in batchmode of %SALOME application.</em>
1267
1268      */
1269     TMPFile SaveASCII(in SComponent theComponent, in string theURL, in boolean isMultiFile);
1270
1271     /*! \brief Loading the data.
1272
1273        This method is called when opening a study.
1274        \param theComponent      %SComponent corresponding to this Component
1275        \param theStream   The file which contains all data saved by the component on Save method
1276        \param isMultiFile  If the value of this boolean parameter is True, the data will be loaded from several files
1277
1278      */
1279
1280     boolean Load(in SComponent theComponent, in TMPFile theStream, in string theURL, in boolean isMultiFile);
1281
1282     /*! \brief Loading the data from files in ASCII format.
1283
1284        This method is called when opening a study.
1285        \param theComponent      %SComponent corresponding to this Component
1286        \param theStream   The file which contains all data saved by the component on Save method
1287        \param isMultiFile  If the value of this boolean parameter is True, the data will be loaded from several files
1288
1289      */
1290
1291     boolean LoadASCII(in SComponent theComponent, in TMPFile theStream, in string theURL, in boolean isMultiFile);
1292
1293     /*! \brief Closing of the study
1294
1295       This method Close is called when closing a study.
1296     \param aSComponent The according %SComponent
1297      */
1298
1299     void Close (in SComponent aSComponent);
1300     //void Close ( in string  aIORSComponent);
1301
1302     /*! Gets the type of the data
1303
1304         \return The type of data produced by the Component in the study.
1305      */
1306
1307      string ComponentDataType();
1308
1309     // Driver Transient -> persistent called for each object in study
1310 /*!
1311    Transforms IOR of a given %SObject into PersistentID. It is called for each
1312    object in the %study.
1313 \note <br> In %SALOME the objects which are present in an active study are identified by an IOR, when this
1314 study is saved these references are transformed into persintent IDs.
1315
1316    \param theSObject The given %SObject.
1317    \param IORString The IOR of the given %SObject.
1318    \param isMultiFile If this parameter is True the study containing the given %SObject is stored in several files.
1319    \param isASCII If this parameter is True the study containing the given %SObject is stored in ASCII format.
1320
1321    \return The persistent ID of the given %SObject
1322
1323 */
1324     string IORToLocalPersistentID (in SObject theSObject,
1325                                    in string IORString,
1326                                    in boolean isMultiFile,
1327                                    in boolean isASCII);
1328 /*!
1329   Transforms PersistentID into IOR of the object. It is called for each
1330    object in the %study.
1331
1332    \note <br> In %SALOME the objects which are present in an saved study (file) are identified by a persistent ID, when this
1333 study is open, these references are transformed into persintent IORs.
1334
1335    \param theSObject The given %SObject.
1336    \param IORString The IOR of the given %SObject.
1337    \param isMultiFile If this parameter is True the study containing the given %SObject is stored in several files.
1338    \param isASCII If this parameter is True the study containing the given %SObject is stored in ASCII format.
1339
1340    \return The IOR of the given %SObject
1341
1342 */
1343     string LocalPersistentIDToIOR (in SObject theSObject,
1344                                    in string aLocalPersistentID,
1345                                    in boolean isMultiFile,
1346                                    in boolean isASCII)
1347       raises (SALOME::SALOME_Exception);
1348
1349     // Publishing in the study
1350 /*! Publishing in the study
1351
1352     \return True if the given %Component can publish a definite object with a given IOR in the %study.
1353     \param theIOR The IOR of a definite object
1354 */
1355     boolean CanPublishInStudy(in Object theIOR) raises (SALOME::SALOME_Exception);
1356 /*! \brief Publishing in the study
1357
1358    Publishes the given object in the %study, using the algorithm of this component.
1359     \param theSObject     If this parameter is null the object is published for the first time. Otherwise
1360     this parameter should contain a reference to the object published earlier
1361     \param theObject      The object which is published
1362     \param theName      The name of the published object. If this parameter is empty, the name is generated
1363     automatically by the component.
1364
1365     \return The published %SObject.
1366 */
1367     SObject PublishInStudy(in SObject theSObject, in Object theObject, in string theName);
1368
1369     // copy/paste methods
1370
1371 /*!
1372     Returns True, if the given %SObject can be copied to the clipboard.
1373
1374     \param theObject The given %SObject which should be copied.
1375 */
1376     boolean CanCopy(in SObject theObject);
1377 /*!
1378     Returns the object %ID and the %TMPFile of the object from the given %SObject.
1379 */
1380     TMPFile CopyFrom(in SObject theObject, out long theObjectID);
1381 /*!
1382     Returns True, if the component can paste the object with given %ID of the component with name <VAR>theComponentName</VAR>.
1383 */
1384     boolean CanPaste(in string theComponentName, in long theObjectID);
1385 /*!
1386     Returns the %SObject of the pasted object.
1387 */
1388     SObject PasteInto(in TMPFile theStream, in long theObjectID, in SObject theObject);
1389
1390   };
1391 };
1392
1393 #endif