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