Salome HOME
ENV: Windows porting.
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_Study_i.hxx
1 //  File   : SALOMEDS_Study_i.hxx
2 //  Author : Sergey RUIN
3 //  Module : SALOME
4
5 #ifndef __SALOMEDS_STUDY_I_H__
6 #define __SALOMEDS_STUDY_I_H__
7
8 // std C++ headers
9 #include <iostream>
10
11 // IDL headers
12 #include <SALOMEconfig.h>
13 #include CORBA_SERVER_HEADER(SALOME_GenericObj)
14 #include CORBA_SERVER_HEADER(SALOMEDS)
15
16 #include <stdio.h>
17
18 //SALOMEDS headers
19 #include "SALOMEDS_SComponentIterator_i.hxx"
20 #include "SALOMEDS_StudyBuilder_i.hxx"
21 #include "SALOMEDS_SObject_i.hxx"
22 #include "SALOMEDS_UseCaseBuilder_i.hxx"
23
24 #include "SALOMEDSImpl_Study.hxx"
25 #include "SALOMEDSImpl_AttributeIOR.hxx"
26
27 class SALOMEDS_Study_i: public POA_SALOMEDS::Study,
28                         public PortableServer::RefCountServantBase 
29 {
30 private:
31   CORBA::ORB_ptr                 _orb;
32   Handle(SALOMEDSImpl_Study)     _impl;  
33   SALOMEDS_StudyBuilder_i*       _builder;    
34
35 public:
36
37   //! standard constructor
38   SALOMEDS_Study_i(const Handle(SALOMEDSImpl_Study), CORBA::ORB_ptr);
39   
40   //! standard destructor
41   virtual ~SALOMEDS_Study_i(); 
42   
43   //! method to Get persistent reference of study (idem URL())
44   /*!
45     \sa URL()
46     \return char* arguments, the persistent reference of the study
47   */  
48   virtual char* GetPersistentReference();
49
50
51   //! method to Get transient reference of study
52   /*!
53     \return char* arguments, the transient reference of the study
54   */  
55   virtual char* GetTransientReference();
56
57   //! method to detect if a study is empty
58   /*!
59     \return bool arguments, true if study is empty
60   */  
61   virtual CORBA::Boolean IsEmpty();
62
63   //! method to Find a Component with ComponentDataType = aComponentName
64   /*!
65     \param aComponentName char* arguments
66     \return SComponent_ptr arguments, the component found
67   */  
68   virtual SALOMEDS::SComponent_ptr FindComponent (const char* aComponentName);
69
70   //! method to Find a Component Find a Component from it's ID
71   /*!
72     \param aComponentID char* arguments
73     \return SComponent_ptr arguments, the component found
74   */  
75   virtual SALOMEDS::SComponent_ptr FindComponentID(const char* aComponentID);
76
77   //! method to  Find an Object with SALOMEDS::Name = anObjectName 
78   /*!
79     \param anObjectName char* arguments
80     \return SObject_ptr arguments, the object found
81   */  
82   virtual SALOMEDS::SObject_ptr FindObject(const char* anObjectName);
83
84
85   //! method to Find Object(s) with SALOMEDS::Name = anObjectName in a component with ComponentDataType = aComponentName
86   /*!
87     \param anObjectName char* arguments
88     \param aComponentName char* arguments
89     \return ListOfSObject_ptr arguments, a list of objects found
90   */  
91   
92   virtual SALOMEDS::Study::ListOfSObject* FindObjectByName( const char* anObjectName, const char* aComponentName ) ;
93   
94   //! method to Find an Object with ID = anObjectID 
95   /*!
96     \param anObjectID char* arguments
97     \return SObject_ptr arguments, the object found
98   */  
99   virtual SALOMEDS::SObject_ptr FindObjectID(const char* anObjectID);
100
101   //! method to Create an Object with ID = anObjectID 
102   /*!
103     \param anObjectID char* arguments
104     \return SObject_ptr arguments, the object found
105   */  
106   virtual SALOMEDS::SObject_ptr CreateObjectID(const char* anObjectID);
107
108   //! method to Find an Object with ID = anObjectIOR 
109   /*!
110     \param anObjectIOR char* arguments
111     \return SObject_ptr arguments, the object found
112   */  
113   virtual SALOMEDS::SObject_ptr FindObjectIOR(const char* anObjectIOR);
114
115   //! method to Find an Object by its path
116   /*!
117     \param thePath char* arguments
118     \return SObject_ptr arguments, the object found
119   */
120   virtual SALOMEDS::SObject_ptr FindObjectByPath(const char* thePath);
121
122   //! method to get a path of SObject
123   /*!
124     \param aSO  SObject_ptr arguments
125     \return char* arguments, the path of the SObject
126   */
127   virtual char* GetObjectPath(CORBA::Object_ptr theObject);
128
129   //! method to set a context: root ('/') is UserData component
130   /*!
131   */
132   virtual void SetContext(const char* thePath);
133
134   //! method to get a context
135   /*!
136   */
137   virtual char* GetContext();  
138
139   //! method to get all object names in the given context (or in the current context, if 'theContext' is empty)
140   /*!
141   */
142   virtual SALOMEDS::ListOfStrings* GetObjectNames(const char* theContext);
143
144   //! method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
145   /*!
146   */
147   virtual SALOMEDS::ListOfStrings* GetDirectoryNames(const char* theContext);
148
149   //! method to get all file names in the given context (or in the current context, if 'theContext' is empty)
150   /*!
151   */
152   virtual SALOMEDS::ListOfStrings* GetFileNames(const char* theContext);
153
154   //! method to get all components names
155   /*!
156   */
157   virtual SALOMEDS::ListOfStrings* GetComponentNames(const char* theContext);
158
159   //! method to Create a ChildIterator from an SObject 
160   /*!
161     \param aSO  SObject_ptr arguments
162     \return ChildIterator_ptr arguments, the created ChildIterator
163   */  
164   virtual SALOMEDS::ChildIterator_ptr NewChildIterator(SALOMEDS::SObject_ptr aSO);
165
166   //! method to Create a SComponentIterator 
167   /*!
168     \return SComponentIterator_ptr arguments, the created SComponentIterator
169   */  
170   virtual SALOMEDS::SComponentIterator_ptr NewComponentIterator();
171
172   //! method to Create a StudyBuilder
173   /*!
174     \return StudyBuilder_ptr arguments, the created StudyBuilder
175   */  
176   virtual SALOMEDS::StudyBuilder_ptr NewBuilder();
177  
178   //! method to get study name
179   /*!
180     \return char* arguments, the study name
181   */
182   virtual char* Name();
183
184   //! method to set study name
185   /*!
186     \param name char* arguments, the study name
187   */
188   virtual void  Name(const char* name);
189
190   //! method to get if study has been saved
191   /*!
192     \return bool arguments
193   */
194   virtual CORBA::Boolean IsSaved();
195
196  //! method to set if study has been saved
197   /*!
198     \param save bool arguments
199   */
200   virtual void  IsSaved(CORBA::Boolean save);
201
202  //! method to Detect if a Study has been modified since it has been saved
203   /*!
204     \return bool arguments
205   */
206   virtual CORBA::Boolean IsModified();
207
208   //! method to get URL of the study (idem GetPersistentReference) 
209   /*!
210     \return char* arguments, the study URL 
211   */
212   virtual char* URL();
213
214  //! method to set URL of the study
215   /*!
216     \param url char* arguments, the study URL
217   */
218   virtual void  URL(const char* url);
219
220   virtual CORBA::Short StudyId();
221   virtual void  StudyId(CORBA::Short id);
222
223   static SALOMEDS::Study_ptr GetStudy(const TDF_Label theLabel, CORBA::ORB_ptr orb);
224
225   static void IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR) theAttribute);
226
227   virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel);
228   
229   virtual SALOMEDS::Study::ListOfSObject* FindDependances(SALOMEDS::SObject_ptr anObject);
230
231   virtual SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties();
232
233   virtual char* GetLastModificationDate();
234
235   virtual SALOMEDS::ListOfDates* GetModificationsDate();
236
237   virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject) {return _orb->object_to_string(theObject); }
238   virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };
239
240   virtual SALOMEDS::UseCaseBuilder_ptr GetUseCaseBuilder();
241
242   virtual void Close();
243
244   void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled) { _impl->EnableUseCaseAutoFilling(isEnabled); }
245
246   // postponed destroying of CORBA object functionality
247   virtual void AddPostponed(const char* theIOR);
248
249   virtual void AddCreatedPostponed(const char* theIOR);
250
251 #ifndef WNT
252   virtual void RemovePostponed(const CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
253                                                         // if theUndoLimit==0, removes all
254   virtual void UndoPostponed(const CORBA::Long theWay); // theWay = 1: resurrect objects,
255                                                 // theWay = -1: get back to the list of postponed
256 #else
257   virtual void RemovePostponed(CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
258                                                         // if theUndoLimit==0, removes all
259   virtual void UndoPostponed(CORBA::Long theWay); // theWay = 1: resurrect objects,
260                                                 // theWay = -1: get back to the list of postponed
261 #endif
262
263   virtual CORBA::Boolean DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished); 
264
265   virtual Handle(SALOMEDSImpl_Study) GetImpl() { return _impl; }
266
267   virtual long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
268 };
269 #endif