Salome HOME
PR: merge from branch BR_auto_V310 tag mergefrom_OCC_development_for_3_2_0a2_10mar06
[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/
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                         public PortableServer::RefCountServantBase 
48 {
49 private:
50   CORBA::ORB_ptr                 _orb;
51   Handle(SALOMEDSImpl_Study)     _impl;  
52   SALOMEDS_StudyBuilder_i*       _builder;    
53
54 public:
55
56   //! standard constructor
57   SALOMEDS_Study_i(const Handle(SALOMEDSImpl_Study), CORBA::ORB_ptr);
58   
59   //! standard destructor
60   virtual ~SALOMEDS_Study_i(); 
61   
62   //! method to Get persistent reference of study (idem URL())
63   /*!
64     \sa URL()
65     \return char* arguments, the persistent reference of the study
66   */  
67   virtual char* GetPersistentReference();
68
69
70   //! method to Get transient reference of study
71   /*!
72     \return char* arguments, the transient reference of the study
73   */  
74   virtual char* GetTransientReference();
75
76   //! method to detect if a study is empty
77   /*!
78     \return bool arguments, true if study is empty
79   */  
80   virtual CORBA::Boolean IsEmpty();
81
82   //! method to Find a Component with ComponentDataType = aComponentName
83   /*!
84     \param aComponentName char* arguments
85     \return SComponent_ptr arguments, the component found
86   */  
87   virtual SALOMEDS::SComponent_ptr FindComponent (const char* aComponentName);
88
89   //! method to Find a Component Find a Component from it's ID
90   /*!
91     \param aComponentID char* arguments
92     \return SComponent_ptr arguments, the component found
93   */  
94   virtual SALOMEDS::SComponent_ptr FindComponentID(const char* aComponentID);
95
96   //! method to  Find an Object with SALOMEDS::Name = anObjectName 
97   /*!
98     \param anObjectName char* arguments
99     \return SObject_ptr arguments, the object found
100   */  
101   virtual SALOMEDS::SObject_ptr FindObject(const char* anObjectName);
102
103
104   //! method to Find Object(s) with SALOMEDS::Name = anObjectName in a component with ComponentDataType = aComponentName
105   /*!
106     \param anObjectName char* arguments
107     \param aComponentName char* arguments
108     \return ListOfSObject_ptr arguments, a list of objects found
109   */  
110   
111   virtual SALOMEDS::Study::ListOfSObject* FindObjectByName( const char* anObjectName, const char* aComponentName ) ;
112   
113   //! method to Find an Object with ID = anObjectID 
114   /*!
115     \param anObjectID char* arguments
116     \return SObject_ptr arguments, the object found
117   */  
118   virtual SALOMEDS::SObject_ptr FindObjectID(const char* anObjectID);
119
120   //! method to Create an Object with ID = anObjectID 
121   /*!
122     \param anObjectID char* arguments
123     \return SObject_ptr arguments, the object found
124   */  
125   virtual SALOMEDS::SObject_ptr CreateObjectID(const char* anObjectID);
126
127   //! method to Find an Object with ID = anObjectIOR 
128   /*!
129     \param anObjectIOR char* arguments
130     \return SObject_ptr arguments, the object found
131   */  
132   virtual SALOMEDS::SObject_ptr FindObjectIOR(const char* anObjectIOR);
133
134   //! method to Find an Object by its path
135   /*!
136     \param thePath char* arguments
137     \return SObject_ptr arguments, the object found
138   */
139   virtual SALOMEDS::SObject_ptr FindObjectByPath(const char* thePath);
140
141   //! method to get a path of SObject
142   /*!
143     \param aSO  SObject_ptr arguments
144     \return char* arguments, the path of the SObject
145   */
146   virtual char* GetObjectPath(CORBA::Object_ptr theObject);
147
148   //! method to set a context: root ('/') is UserData component
149   /*!
150   */
151   virtual void SetContext(const char* thePath);
152
153   //! method to get a context
154   /*!
155   */
156   virtual char* GetContext();  
157
158   //! method to get all object names in the given context (or in the current context, if 'theContext' is empty)
159   /*!
160   */
161   virtual SALOMEDS::ListOfStrings* GetObjectNames(const char* theContext);
162
163   //! method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
164   /*!
165   */
166   virtual SALOMEDS::ListOfStrings* GetDirectoryNames(const char* theContext);
167
168   //! method to get all file names in the given context (or in the current context, if 'theContext' is empty)
169   /*!
170   */
171   virtual SALOMEDS::ListOfStrings* GetFileNames(const char* theContext);
172
173   //! method to get all components names
174   /*!
175   */
176   virtual SALOMEDS::ListOfStrings* GetComponentNames(const char* theContext);
177
178   //! method to Create a ChildIterator from an SObject 
179   /*!
180     \param aSO  SObject_ptr arguments
181     \return ChildIterator_ptr arguments, the created ChildIterator
182   */  
183   virtual SALOMEDS::ChildIterator_ptr NewChildIterator(SALOMEDS::SObject_ptr aSO);
184
185   //! method to Create a SComponentIterator 
186   /*!
187     \return SComponentIterator_ptr arguments, the created SComponentIterator
188   */  
189   virtual SALOMEDS::SComponentIterator_ptr NewComponentIterator();
190
191   //! method to Create a StudyBuilder
192   /*!
193     \return StudyBuilder_ptr arguments, the created StudyBuilder
194   */  
195   virtual SALOMEDS::StudyBuilder_ptr NewBuilder();
196  
197   //! method to get study name
198   /*!
199     \return char* arguments, the study name
200   */
201   virtual char* Name();
202
203   //! method to set study name
204   /*!
205     \param name char* arguments, the study name
206   */
207   virtual void  Name(const char* name);
208
209   //! method to get if study has been saved
210   /*!
211     \return bool arguments
212   */
213   virtual CORBA::Boolean IsSaved();
214
215  //! method to set if study has been saved
216   /*!
217     \param save bool arguments
218   */
219   virtual void  IsSaved(CORBA::Boolean save);
220
221  //! method to Detect if a Study has been modified since it has been saved
222   /*!
223     \return bool arguments
224   */
225   virtual CORBA::Boolean IsModified();
226
227   //! method to get URL of the study (idem GetPersistentReference) 
228   /*!
229     \return char* arguments, the study URL 
230   */
231   virtual char* URL();
232
233  //! method to set URL of the study
234   /*!
235     \param url char* arguments, the study URL
236   */
237   virtual void  URL(const char* url);
238
239   virtual CORBA::Short StudyId();
240   virtual void  StudyId(CORBA::Short id);
241
242   static SALOMEDS::Study_ptr GetStudy(const TDF_Label theLabel, CORBA::ORB_ptr orb);
243
244   static void IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR) theAttribute);
245
246   virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel);
247   
248   virtual SALOMEDS::Study::ListOfSObject* FindDependances(SALOMEDS::SObject_ptr anObject);
249
250   virtual SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties();
251
252   virtual char* GetLastModificationDate();
253
254   virtual SALOMEDS::ListOfDates* GetModificationsDate();
255
256   virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject) {return _orb->object_to_string(theObject); }
257   virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };
258
259   virtual SALOMEDS::UseCaseBuilder_ptr GetUseCaseBuilder();
260
261   virtual void Close();
262
263   void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled) { _impl->EnableUseCaseAutoFilling(isEnabled); }
264
265   // postponed destroying of CORBA object functionality
266   virtual void AddPostponed(const char* theIOR);
267
268   virtual void AddCreatedPostponed(const char* theIOR);
269
270 #ifndef WNT
271   virtual void RemovePostponed(const CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
272                                                         // if theUndoLimit==0, removes all
273   virtual void UndoPostponed(const CORBA::Long theWay); // theWay = 1: resurrect objects,
274                                                 // theWay = -1: get back to the list of postponed
275 #else
276   virtual void RemovePostponed(CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
277                                                         // if theUndoLimit==0, removes all
278   virtual void UndoPostponed(CORBA::Long theWay); // theWay = 1: resurrect objects,
279                                                 // theWay = -1: get back to the list of postponed
280 #endif
281
282   virtual SALOMEDS::AttributeParameter_ptr GetCommonParameters(const char* theID, CORBA::Long theSavePoint);
283   virtual SALOMEDS::AttributeParameter_ptr GetModuleParameters(const char* theID, 
284                                                                const char* theModuleName, 
285                                                                CORBA::Long theSavePoint);
286
287   virtual char* GetDefaultScript(const char* theModuleName, const char* theShift);
288
289   virtual CORBA::Boolean DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished);
290
291   virtual Handle(SALOMEDSImpl_Study) GetImpl() { return _impl; }
292
293   virtual CORBA::Long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
294 };
295 #endif