Salome HOME
Merging from V4_1_0_maintainance for porting on Win32 Platform
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_Study_i.hxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //  File   : SALOMEDS_Study_i.hxx
21 //  Author : Sergey RUIN
22 //  Module : SALOME
23
24 #ifndef __SALOMEDS_STUDY_I_H__
25 #define __SALOMEDS_STUDY_I_H__
26
27 // std C++ headers
28 #include <iostream>
29
30 // IDL headers
31 #include <SALOMEconfig.h>
32 #include CORBA_SERVER_HEADER(SALOME_GenericObj)
33 #include CORBA_SERVER_HEADER(SALOMEDS)
34
35 #include <stdio.h>
36
37 //SALOMEDS headers
38 #include "SALOMEDS_SComponentIterator_i.hxx"
39 #include "SALOMEDS_StudyBuilder_i.hxx"
40 #include "SALOMEDS_SObject_i.hxx"
41 #include "SALOMEDS_UseCaseBuilder_i.hxx"
42
43 #include "SALOMEDSImpl_Study.hxx"
44 #include "SALOMEDSImpl_AttributeIOR.hxx"
45
46 class Standard_EXPORT SALOMEDS_Study_i: public POA_SALOMEDS::Study
47 {
48 private:
49   CORBA::ORB_ptr                 _orb;
50   SALOMEDSImpl_Study*            _impl;  
51   SALOMEDS_StudyBuilder_i*       _builder;    
52
53 public:
54
55   //! standard constructor
56   SALOMEDS_Study_i(SALOMEDSImpl_Study*, CORBA::ORB_ptr);
57   
58   //! standard destructor
59   virtual ~SALOMEDS_Study_i(); 
60   
61   //! method to Get persistent reference of study (idem URL())
62   /*!
63     \sa URL()
64     \return char* arguments, the persistent reference of the study
65   */  
66   virtual char* GetPersistentReference();
67
68
69   //! method to Get transient reference of study
70   /*!
71     \return char* arguments, the transient reference of the study
72   */  
73   virtual char* GetTransientReference();
74
75   //! method to detect if a study is empty
76   /*!
77     \return bool arguments, true if study is empty
78   */  
79   virtual CORBA::Boolean IsEmpty();
80
81   //! method to Find a Component with ComponentDataType = aComponentName
82   /*!
83     \param aComponentName char* arguments
84     \return SComponent_ptr arguments, the component found
85   */  
86   virtual SALOMEDS::SComponent_ptr FindComponent (const char* aComponentName);
87
88   //! method to Find a Component Find a Component from it's ID
89   /*!
90     \param aComponentID char* arguments
91     \return SComponent_ptr arguments, the component found
92   */  
93   virtual SALOMEDS::SComponent_ptr FindComponentID(const char* aComponentID);
94
95   //! method to  Find an Object with SALOMEDS::Name = anObjectName 
96   /*!
97     \param anObjectName char* arguments
98     \return SObject_ptr arguments, the object found
99   */  
100   virtual SALOMEDS::SObject_ptr FindObject(const char* anObjectName);
101
102
103   //! method to Find Object(s) with SALOMEDS::Name = anObjectName in a component with ComponentDataType = aComponentName
104   /*!
105     \param anObjectName char* arguments
106     \param aComponentName char* arguments
107     \return ListOfSObject_ptr arguments, a list of objects found
108   */  
109   
110   virtual SALOMEDS::Study::ListOfSObject* FindObjectByName( const char* anObjectName, const char* aComponentName ) ;
111   
112   //! method to Find an Object with ID = anObjectID 
113   /*!
114     \param anObjectID char* arguments
115     \return SObject_ptr arguments, the object found
116   */  
117   virtual SALOMEDS::SObject_ptr FindObjectID(const char* anObjectID);
118
119   //! method to Create an Object with ID = anObjectID 
120   /*!
121     \param anObjectID char* arguments
122     \return SObject_ptr arguments, the object found
123   */  
124   virtual SALOMEDS::SObject_ptr CreateObjectID(const char* anObjectID);
125
126   //! method to Find an Object with ID = anObjectIOR 
127   /*!
128     \param anObjectIOR char* arguments
129     \return SObject_ptr arguments, the object found
130   */  
131   virtual SALOMEDS::SObject_ptr FindObjectIOR(const char* anObjectIOR);
132
133   //! method to Find an Object by its path
134   /*!
135     \param thePath char* arguments
136     \return SObject_ptr arguments, the object found
137   */
138   virtual SALOMEDS::SObject_ptr FindObjectByPath(const char* thePath);
139
140   //! method to get a path of SObject
141   /*!
142     \param aSO  SObject_ptr arguments
143     \return char* arguments, the path of the SObject
144   */
145   virtual char* GetObjectPath(CORBA::Object_ptr theObject);
146
147   //! method to set a context: root ('/') is UserData component
148   /*!
149   */
150   virtual void SetContext(const char* thePath);
151
152   //! method to get a context
153   /*!
154   */
155   virtual char* GetContext();  
156
157   //! method to get all object names in the given context (or in the current context, if 'theContext' is empty)
158   /*!
159   */
160   virtual SALOMEDS::ListOfStrings* GetObjectNames(const char* theContext);
161
162   //! method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
163   /*!
164   */
165   virtual SALOMEDS::ListOfStrings* GetDirectoryNames(const char* theContext);
166
167   //! method to get all file names in the given context (or in the current context, if 'theContext' is empty)
168   /*!
169   */
170   virtual SALOMEDS::ListOfStrings* GetFileNames(const char* theContext);
171
172   //! method to get all components names
173   /*!
174   */
175   virtual SALOMEDS::ListOfStrings* GetComponentNames(const char* theContext);
176
177   //! method to Create a ChildIterator from an SObject 
178   /*!
179     \param aSO  SObject_ptr arguments
180     \return ChildIterator_ptr arguments, the created ChildIterator
181   */  
182   virtual SALOMEDS::ChildIterator_ptr NewChildIterator(SALOMEDS::SObject_ptr aSO);
183
184   //! method to Create a SComponentIterator 
185   /*!
186     \return SComponentIterator_ptr arguments, the created SComponentIterator
187   */  
188   virtual SALOMEDS::SComponentIterator_ptr NewComponentIterator();
189
190   //! method to Create a StudyBuilder
191   /*!
192     \return StudyBuilder_ptr arguments, the created StudyBuilder
193   */  
194   virtual SALOMEDS::StudyBuilder_ptr NewBuilder();
195  
196   //! method to get study name
197   /*!
198     \return char* arguments, the study name
199   */
200   virtual char* Name();
201
202   //! method to set study name
203   /*!
204     \param name char* arguments, the study name
205   */
206   virtual void  Name(const char* name);
207
208   //! method to get if study has been saved
209   /*!
210     \return bool arguments
211   */
212   virtual CORBA::Boolean IsSaved();
213
214  //! method to set if study has been saved
215   /*!
216     \param save bool arguments
217   */
218   virtual void  IsSaved(CORBA::Boolean save);
219
220  //! method to Detect if a Study has been modified since it has been saved
221   /*!
222     \return bool arguments
223   */
224   virtual CORBA::Boolean IsModified();
225
226  //! method to set Modified flag of a Study to True
227   virtual void Modified();
228
229   //! method to get URL of the study (idem GetPersistentReference) 
230   /*!
231     \return char* arguments, the study URL 
232   */
233   virtual char* URL();
234
235  //! method to set URL of the study
236   /*!
237     \param url char* arguments, the study URL
238   */
239   virtual void  URL(const char* url);
240
241   virtual CORBA::Short StudyId();
242   virtual void  StudyId(CORBA::Short id);
243
244   static SALOMEDS::Study_ptr GetStudy(const DF_Label& theLabel, CORBA::ORB_ptr orb);
245
246   static void IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute);
247
248   virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel);
249   
250   virtual SALOMEDS::Study::ListOfSObject* FindDependances(SALOMEDS::SObject_ptr anObject);
251
252   virtual SALOMEDS::AttributeStudyProperties_ptr GetProperties();
253
254   virtual char* GetLastModificationDate();
255
256   virtual SALOMEDS::ListOfDates* GetModificationsDate();
257
258   virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject) {return _orb->object_to_string(theObject); }
259   virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };
260
261   virtual SALOMEDS::UseCaseBuilder_ptr GetUseCaseBuilder();
262
263   virtual void Close();
264
265   void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled); 
266
267   // postponed destroying of CORBA object functionality
268   virtual void AddPostponed(const char* theIOR);
269
270   virtual void AddCreatedPostponed(const char* theIOR);
271
272 #ifndef WIN32
273   virtual void RemovePostponed(const CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
274                                                         // if theUndoLimit==0, removes all
275   virtual void UndoPostponed(const CORBA::Long theWay); // theWay = 1: resurrect objects,
276                                                 // theWay = -1: get back to the list of postponed
277 #else
278   virtual void RemovePostponed(CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
279                                                         // if theUndoLimit==0, removes all
280   virtual void UndoPostponed(CORBA::Long theWay); // theWay = 1: resurrect objects,
281                                                 // theWay = -1: get back to the list of postponed
282 #endif
283
284   virtual SALOMEDS::AttributeParameter_ptr GetCommonParameters(const char* theID, CORBA::Long theSavePoint);
285   virtual SALOMEDS::AttributeParameter_ptr GetModuleParameters(const char* theID, 
286                                                                const char* theModuleName, 
287                                                                CORBA::Long theSavePoint);
288
289   virtual void SetStudyLock(const char* theLockerID);
290
291   virtual bool IsStudyLocked();
292
293   virtual void UnLockStudy(const char* theLockerID);
294
295   virtual SALOMEDS::ListOfStrings* GetLockerID();
296
297   virtual char* GetDefaultScript(const char* theModuleName, const char* theShift);
298
299   virtual CORBA::Boolean DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished);
300
301   virtual SALOMEDSImpl_Study* GetImpl() { return _impl; }
302
303   virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
304 };
305 #endif