]> SALOME platform Git repositories - modules/kernel.git/blob - src/SALOMEDS/SALOMEDS_Study_i.hxx
Salome HOME
Merge branch 'occ/shaper2smesh'
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_Study_i.hxx
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_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
70   virtual ~SALOMEDS_Study_i();
71
72   virtual PortableServer::POA_ptr _default_POA();
73
74   virtual void Init();
75   virtual void Clear();
76
77   //! method to open a Study
78   /*!
79     \param char* arguments, the study URL
80     \return bool arguments
81   */
82   virtual bool Open(const wchar_t* aStudyUrl) throw (SALOME::SALOME_Exception);
83
84   //! method to check that a Study can be opened
85   /*!
86     \param char* arguments, the study URL
87     \return bool arguments
88   */
89   virtual bool CanOpen(const wchar_t* aStudyUrl);
90
91   //! method to save a Study
92   virtual CORBA::Boolean Save(CORBA::Boolean theMultiFile, CORBA::Boolean theASCII);
93
94   //! method to save a Study to the persistent reference aUrl
95   /*!
96     \param char* arguments, the new URL of the study
97   */
98   virtual CORBA::Boolean SaveAs(const wchar_t* aUrl, CORBA::Boolean theMultiFile, CORBA::Boolean theASCII);
99
100   //! method to copy the object
101   /*!
102     \param theObject object to copy
103   */
104   virtual CORBA::Boolean Copy(SALOMEDS::SObject_ptr theObject);
105   virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
106   //! method to paste the object in study
107   /*!
108     \param theObject object to paste
109   */
110   virtual SALOMEDS::SObject_ptr Paste(SALOMEDS::SObject_ptr theObject) throw(SALOMEDS::StudyBuilder::LockProtection);
111   virtual CORBA::Boolean CanPaste(SALOMEDS::SObject_ptr theObject);
112
113   //! method to Get persistent reference of study (idem URL())
114   /*!
115     \sa URL()
116     \return char* arguments, the persistent reference of the study
117   */  
118   virtual char* GetPersistentReference();
119
120   //! method to detect if a study is empty
121   /*!
122     \return bool arguments, true if study is empty
123   */  
124   virtual CORBA::Boolean IsEmpty();
125
126   //! method to Find a Component with ComponentDataType = aComponentName
127   /*!
128     \param aComponentName char* arguments
129     \return SComponent_ptr arguments, the component found
130   */  
131   virtual SALOMEDS::SComponent_ptr FindComponent (const char* aComponentName);
132
133   //! method to Find a Component Find a Component from it's ID
134   /*!
135     \param aComponentID char* arguments
136     \return SComponent_ptr arguments, the component found
137   */  
138   virtual SALOMEDS::SComponent_ptr FindComponentID(const char* aComponentID);
139
140   //! method to  Find an Object with SALOMEDS::Name = anObjectName 
141   /*!
142     \param anObjectName char* arguments
143     \return SObject_ptr arguments, the object found
144   */  
145   virtual SALOMEDS::SObject_ptr FindObject(const char* anObjectName);
146
147
148   //! method to Find Object(s) with SALOMEDS::Name = anObjectName in a component with ComponentDataType = aComponentName
149   /*!
150     \param anObjectName char* arguments
151     \param aComponentName char* arguments
152     \return ListOfSObject_ptr arguments, a list of objects found
153   */  
154   
155   virtual SALOMEDS::Study::ListOfSObject* FindObjectByName( const char* anObjectName, const char* aComponentName ) ;
156   
157   //! method to Find an Object with ID = anObjectID 
158   /*!
159     \param anObjectID char* arguments
160     \return SObject_ptr arguments, the object found
161   */  
162   virtual SALOMEDS::SObject_ptr FindObjectID(const char* anObjectID);
163
164   //! method to Create an Object with ID = anObjectID 
165   /*!
166     \param anObjectID char* arguments
167     \return SObject_ptr arguments, the object found
168   */  
169   virtual SALOMEDS::SObject_ptr CreateObjectID(const char* anObjectID);
170
171   //! method to Find an Object with ID = anObjectIOR 
172   /*!
173     \param anObjectIOR char* arguments
174     \return SObject_ptr arguments, the object found
175   */  
176   virtual SALOMEDS::SObject_ptr FindObjectIOR(const char* anObjectIOR);
177
178   //! method to Find an Object by its path
179   /*!
180     \param thePath char* arguments
181     \return SObject_ptr arguments, the object found
182   */
183   virtual SALOMEDS::SObject_ptr FindObjectByPath(const char* thePath);
184
185   //! method to get a path of SObject
186   /*!
187     \param aSO  SObject_ptr arguments
188     \return char* arguments, the path of the SObject
189   */
190   virtual char* GetObjectPath(CORBA::Object_ptr theObject);
191
192   //! method to Create a ChildIterator from an SObject 
193   /*!
194     \param aSO  SObject_ptr arguments
195     \return ChildIterator_ptr arguments, the created ChildIterator
196   */  
197   virtual SALOMEDS::ChildIterator_ptr NewChildIterator(SALOMEDS::SObject_ptr aSO);
198
199   //! method to Create a SComponentIterator 
200   /*!
201     \return SComponentIterator_ptr arguments, the created SComponentIterator
202   */  
203   virtual SALOMEDS::SComponentIterator_ptr NewComponentIterator();
204
205   //! method to Create a StudyBuilder
206   /*!
207     \return StudyBuilder_ptr arguments, the created StudyBuilder
208   */  
209   virtual SALOMEDS::StudyBuilder_ptr NewBuilder();
210  
211   //! method to get study name
212   /*!
213     \return char* arguments, the study name
214   */
215   virtual wchar_t* Name();
216
217   //! method to set study name
218   /*!
219     \param name char* arguments, the study name
220   */
221   virtual void Name(const wchar_t* name);
222
223   //! method to get if study has been saved
224   /*!
225     \return bool arguments
226   */
227   virtual CORBA::Boolean IsSaved();
228
229  //! method to set if study has been saved
230   /*!
231     \param save bool arguments
232   */
233   virtual void  IsSaved(CORBA::Boolean save);
234
235  //! method to Detect if a Study has been modified since it has been saved
236   /*!
237     \return bool arguments
238   */
239   virtual CORBA::Boolean IsModified();
240
241  //! method to set Modified flag of a Study to True
242   virtual void Modified();
243
244   //! method to get URL of the study (idem GetPersistentReference) 
245   /*!
246     \return char* arguments, the study URL 
247   */
248   virtual wchar_t* URL();
249
250  //! method to set URL of the study
251   /*!
252     \param url char* arguments, the study URL
253   */
254   virtual void URL(const wchar_t* url);
255
256   static void IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute);
257
258   virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel);
259   
260   virtual SALOMEDS::Study::ListOfSObject* FindDependances(SALOMEDS::SObject_ptr anObject);
261
262   virtual SALOMEDS::AttributeStudyProperties_ptr GetProperties();
263
264   virtual char* GetLastModificationDate();
265
266   virtual SALOMEDS::ListOfDates* GetModificationsDate();
267
268   virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject) {return _orb->object_to_string(theObject); }
269   virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };
270
271   virtual SALOMEDS::UseCaseBuilder_ptr GetUseCaseBuilder();
272
273   void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled); 
274
275   // postponed destroying of CORBA object functionality
276   virtual void AddPostponed(const char* theIOR);
277
278   virtual void AddCreatedPostponed(const char* theIOR);
279
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
285   virtual SALOMEDS::AttributeParameter_ptr GetCommonParameters(const char* theID, CORBA::Long theSavePoint);
286   virtual SALOMEDS::AttributeParameter_ptr GetModuleParameters(const char* theID, 
287                                                                const char* theModuleName, 
288                                                                CORBA::Long theSavePoint);
289
290   virtual void SetStudyLock(const char* theLockerID);
291
292   virtual bool IsStudyLocked();
293
294   virtual void UnLockStudy(const char* theLockerID);
295
296   virtual SALOMEDS::ListOfStrings* GetLockerID();
297
298   virtual void SetReal(const char* theVarName, CORBA::Double theValue);
299   
300   virtual void SetInteger(const char* theVarName, CORBA::Long theValue);
301
302   virtual void SetBoolean(const char* theVarName, CORBA::Boolean theValue);
303
304   virtual void SetString(const char* theVarName, const char* theValue);
305
306   virtual void SetStringAsDouble(const char* theVarName, CORBA::Double theValue);
307
308   virtual CORBA::Double GetReal(const char* theVarName);
309   
310   virtual CORBA::Long GetInteger(const char* theVarName);
311
312   virtual CORBA::Boolean GetBoolean(const char* theVarName);
313
314   virtual char* GetString(const char* theVarName);
315
316   virtual CORBA::Boolean IsReal(const char* theVarName);
317   
318   virtual CORBA::Boolean IsInteger(const char* theVarName);
319
320   virtual CORBA::Boolean IsBoolean(const char* theVarName);
321
322   virtual CORBA::Boolean IsString(const char* theVarName);
323
324   virtual CORBA::Boolean IsVariable(const char* theVarName);
325
326   virtual SALOMEDS::ListOfStrings* GetVariableNames();
327
328   virtual CORBA::Boolean RemoveVariable(const char* theVarName);
329
330   virtual CORBA::Boolean RenameVariable(const char* theVarName, const char* theNewVarName);
331
332   virtual CORBA::Boolean IsVariableUsed(const char* theVarName);
333   
334   virtual SALOMEDS::ListOfListOfStrings* ParseVariables(const char* theVars);
335
336   virtual char* GetDefaultScript(const char* theModuleName, const char* theShift);
337
338   virtual CORBA::Boolean DumpStudy(const char* thePath,
339                                    const char* theBaseName,
340                                    CORBA::Boolean isPublished,
341                                    CORBA::Boolean isMultiFile);
342
343   virtual char* GetDumpPath();
344
345   virtual SALOMEDSImpl_Study* GetImpl() { return _impl; }
346
347   virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
348
349   static void SetThePOA(PortableServer::POA_ptr);
350   static PortableServer::POA_ptr GetThePOA();
351
352   void ping(){};
353   CORBA::Long getPID();
354   void ShutdownWithExit();
355
356   void Shutdown();
357
358   virtual void attach(SALOMEDS::Observer_ptr theObs, CORBA::Boolean modify);
359   virtual void detach(SALOMEDS::Observer_ptr theObs);
360 };
361 #endif