Salome HOME
merge from branch BR_V5_DEV
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_Study_i.hxx
1 //  Copyright (C) 2007-2008  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.
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 //  File   : SALOMEDS_Study_i.hxx
23 //  Author : Sergey RUIN
24 //  Module : SALOME
25 //
26 #ifndef __SALOMEDS_STUDY_I_H__
27 #define __SALOMEDS_STUDY_I_H__
28
29 // std C++ headers
30 #include <iostream>
31
32 // IDL headers
33 #include <SALOMEconfig.h>
34 #include CORBA_SERVER_HEADER(SALOME_GenericObj)
35 #include CORBA_SERVER_HEADER(SALOMEDS)
36
37 #include <stdio.h>
38
39 //SALOMEDS headers
40 #include "SALOMEDS_SComponentIterator_i.hxx"
41 #include "SALOMEDS_StudyBuilder_i.hxx"
42 #include "SALOMEDS_SObject_i.hxx"
43 #include "SALOMEDS_UseCaseBuilder_i.hxx"
44
45 #include "SALOMEDSImpl_Study.hxx"
46 #include "SALOMEDSImpl_AttributeIOR.hxx"
47
48 class Standard_EXPORT SALOMEDS_Study_i: public POA_SALOMEDS::Study
49 {
50 private:
51   CORBA::ORB_ptr                 _orb;
52   SALOMEDSImpl_Study*            _impl;  
53   SALOMEDS_StudyBuilder_i*       _builder;    
54
55 public:
56
57   //! standard constructor
58   SALOMEDS_Study_i(SALOMEDSImpl_Study*, CORBA::ORB_ptr);
59   
60   //! standard destructor
61   virtual ~SALOMEDS_Study_i(); 
62   
63   //! method to Get persistent reference of study (idem URL())
64   /*!
65     \sa URL()
66     \return char* arguments, the persistent reference of the study
67   */  
68   virtual char* GetPersistentReference();
69
70
71   //! method to Get transient reference of study
72   /*!
73     \return char* arguments, the transient reference of the study
74   */  
75   virtual char* GetTransientReference();
76
77   //! method to detect if a study is empty
78   /*!
79     \return bool arguments, true if study is empty
80   */  
81   virtual CORBA::Boolean IsEmpty();
82
83   //! method to Find a Component with ComponentDataType = aComponentName
84   /*!
85     \param aComponentName char* arguments
86     \return SComponent_ptr arguments, the component found
87   */  
88   virtual SALOMEDS::SComponent_ptr FindComponent (const char* aComponentName);
89
90   //! method to Find a Component Find a Component from it's ID
91   /*!
92     \param aComponentID char* arguments
93     \return SComponent_ptr arguments, the component found
94   */  
95   virtual SALOMEDS::SComponent_ptr FindComponentID(const char* aComponentID);
96
97   //! method to  Find an Object with SALOMEDS::Name = anObjectName 
98   /*!
99     \param anObjectName char* arguments
100     \return SObject_ptr arguments, the object found
101   */  
102   virtual SALOMEDS::SObject_ptr FindObject(const char* anObjectName);
103
104
105   //! method to Find Object(s) with SALOMEDS::Name = anObjectName in a component with ComponentDataType = aComponentName
106   /*!
107     \param anObjectName char* arguments
108     \param aComponentName char* arguments
109     \return ListOfSObject_ptr arguments, a list of objects found
110   */  
111   
112   virtual SALOMEDS::Study::ListOfSObject* FindObjectByName( const char* anObjectName, const char* aComponentName ) ;
113   
114   //! method to Find an Object with ID = anObjectID 
115   /*!
116     \param anObjectID char* arguments
117     \return SObject_ptr arguments, the object found
118   */  
119   virtual SALOMEDS::SObject_ptr FindObjectID(const char* anObjectID);
120
121   //! method to Create an Object with ID = anObjectID 
122   /*!
123     \param anObjectID char* arguments
124     \return SObject_ptr arguments, the object found
125   */  
126   virtual SALOMEDS::SObject_ptr CreateObjectID(const char* anObjectID);
127
128   //! method to Find an Object with ID = anObjectIOR 
129   /*!
130     \param anObjectIOR char* arguments
131     \return SObject_ptr arguments, the object found
132   */  
133   virtual SALOMEDS::SObject_ptr FindObjectIOR(const char* anObjectIOR);
134
135   //! method to Find an Object by its path
136   /*!
137     \param thePath char* arguments
138     \return SObject_ptr arguments, the object found
139   */
140   virtual SALOMEDS::SObject_ptr FindObjectByPath(const char* thePath);
141
142   //! method to get a path of SObject
143   /*!
144     \param aSO  SObject_ptr arguments
145     \return char* arguments, the path of the SObject
146   */
147   virtual char* GetObjectPath(CORBA::Object_ptr theObject);
148
149   //! method to set a context: root ('/') is UserData component
150   /*!
151   */
152   virtual void SetContext(const char* thePath);
153
154   //! method to get a context
155   /*!
156   */
157   virtual char* GetContext();  
158
159   //! method to get all object names in the given context (or in the current context, if 'theContext' is empty)
160   /*!
161   */
162   virtual SALOMEDS::ListOfStrings* GetObjectNames(const char* theContext);
163
164   //! method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
165   /*!
166   */
167   virtual SALOMEDS::ListOfStrings* GetDirectoryNames(const char* theContext);
168
169   //! method to get all file names in the given context (or in the current context, if 'theContext' is empty)
170   /*!
171   */
172   virtual SALOMEDS::ListOfStrings* GetFileNames(const char* theContext);
173
174   //! method to get all components names
175   /*!
176   */
177   virtual SALOMEDS::ListOfStrings* GetComponentNames(const char* theContext);
178
179   //! method to Create a ChildIterator from an SObject 
180   /*!
181     \param aSO  SObject_ptr arguments
182     \return ChildIterator_ptr arguments, the created ChildIterator
183   */  
184   virtual SALOMEDS::ChildIterator_ptr NewChildIterator(SALOMEDS::SObject_ptr aSO);
185
186   //! method to Create a SComponentIterator 
187   /*!
188     \return SComponentIterator_ptr arguments, the created SComponentIterator
189   */  
190   virtual SALOMEDS::SComponentIterator_ptr NewComponentIterator();
191
192   //! method to Create a StudyBuilder
193   /*!
194     \return StudyBuilder_ptr arguments, the created StudyBuilder
195   */  
196   virtual SALOMEDS::StudyBuilder_ptr NewBuilder();
197  
198   //! method to get study name
199   /*!
200     \return char* arguments, the study name
201   */
202   virtual char* Name();
203
204   //! method to set study name
205   /*!
206     \param name char* arguments, the study name
207   */
208   virtual void  Name(const char* name);
209
210   //! method to get if study has been saved
211   /*!
212     \return bool arguments
213   */
214   virtual CORBA::Boolean IsSaved();
215
216  //! method to set if study has been saved
217   /*!
218     \param save bool arguments
219   */
220   virtual void  IsSaved(CORBA::Boolean save);
221
222  //! method to Detect if a Study has been modified since it has been saved
223   /*!
224     \return bool arguments
225   */
226   virtual CORBA::Boolean IsModified();
227
228  //! method to set Modified flag of a Study to True
229   virtual void Modified();
230
231   //! method to get URL of the study (idem GetPersistentReference) 
232   /*!
233     \return char* arguments, the study URL 
234   */
235   virtual char* URL();
236
237  //! method to set URL of the study
238   /*!
239     \param url char* arguments, the study URL
240   */
241   virtual void  URL(const char* url);
242
243   virtual CORBA::Short StudyId();
244   virtual void  StudyId(CORBA::Short id);
245
246   static SALOMEDS::Study_ptr GetStudy(const DF_Label& theLabel, CORBA::ORB_ptr orb);
247
248   static void IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute);
249
250   virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel);
251   
252   virtual SALOMEDS::Study::ListOfSObject* FindDependances(SALOMEDS::SObject_ptr anObject);
253
254   virtual SALOMEDS::AttributeStudyProperties_ptr GetProperties();
255
256   virtual char* GetLastModificationDate();
257
258   virtual SALOMEDS::ListOfDates* GetModificationsDate();
259
260   virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject) {return _orb->object_to_string(theObject); }
261   virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };
262
263   virtual SALOMEDS::UseCaseBuilder_ptr GetUseCaseBuilder();
264
265   virtual void Close();
266
267   void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled); 
268
269   // postponed destroying of CORBA object functionality
270   virtual void AddPostponed(const char* theIOR);
271
272   virtual void AddCreatedPostponed(const char* theIOR);
273
274 #ifndef WIN32
275   virtual void RemovePostponed(const CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
276                                                         // if theUndoLimit==0, removes all
277   virtual void UndoPostponed(const CORBA::Long theWay); // theWay = 1: resurrect objects,
278                                                 // theWay = -1: get back to the list of postponed
279 #else
280   virtual void RemovePostponed(CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
281                                                         // if theUndoLimit==0, removes all
282   virtual void UndoPostponed(CORBA::Long theWay); // theWay = 1: resurrect objects,
283                                                 // theWay = -1: get back to the list of postponed
284 #endif
285
286   virtual SALOMEDS::AttributeParameter_ptr GetCommonParameters(const char* theID, CORBA::Long theSavePoint);
287   virtual SALOMEDS::AttributeParameter_ptr GetModuleParameters(const char* theID, 
288                                                                const char* theModuleName, 
289                                                                CORBA::Long theSavePoint);
290
291   virtual void SetStudyLock(const char* theLockerID);
292
293   virtual bool IsStudyLocked();
294
295   virtual void UnLockStudy(const char* theLockerID);
296
297   virtual SALOMEDS::ListOfStrings* GetLockerID();
298
299   virtual void SetReal(const char* theVarName, CORBA::Double theValue);
300   
301   virtual void SetInteger(const char* theVarName, CORBA::Long theValue);
302
303   virtual void SetBoolean(const char* theVarName, CORBA::Boolean theValue);
304
305   virtual CORBA::Double GetReal(const char* theVarName);
306   
307   virtual CORBA::Long GetInteger(const char* theVarName);
308
309   virtual CORBA::Boolean GetBoolean(const char* theVarName);
310
311   virtual CORBA::Boolean IsReal(const char* theVarName);
312   
313   virtual CORBA::Boolean IsInteger(const char* theVarName);
314
315   virtual CORBA::Boolean IsBoolean(const char* theVarName);
316
317   virtual CORBA::Boolean IsVariable(const char* theVarName);
318
319   virtual SALOMEDS::ListOfStrings* GetVariableNames();
320
321   virtual CORBA::Boolean RemoveVariable(const char* theVarName);
322
323   virtual CORBA::Boolean RenameVariable(const char* theVarName, const char* theNewVarName);
324
325   virtual CORBA::Boolean IsVariableUsed(const char* theVarName);
326   
327   virtual SALOMEDS::ListOfListOfStrings* ParseVariables(const char* theVars);
328
329   virtual char* GetDefaultScript(const char* theModuleName, const char* theShift);
330
331   virtual CORBA::Boolean DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished);
332
333   virtual SALOMEDSImpl_Study* GetImpl() { return _impl; }
334
335   virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
336 };
337 #endif