]> SALOME platform Git repositories - modules/kernel.git/blob - src/SALOMEDS/SALOMEDS_Study_i.hxx
Salome HOME
fa5cffabaf3e427eb06574f7ff7a549d8d55a87c
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_Study_i.hxx
1 //  SALOME SALOMEDS : data structure of SALOME and sources of Salome data server 
2 //
3 //  Copyright (C) 2003  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. 
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SALOMEDS_Study_i.hxx
25 //  Author : Yves FRICAUD
26 //  Module : SALOME
27 //  $Header$
28
29 #ifndef __SALOMEDS_STUDY_I_H__
30 #define __SALOMEDS_STUDY_I_H__
31
32 // std C++ headers
33 #include <iostream.h>
34
35 // IDL headers
36 #include <SALOMEconfig.h>
37 #include CORBA_SERVER_HEADER(SALOMEDS)
38
39 // Cascade headers
40 #include <TDocStd_Document.hxx>
41 #include <TDF_Tool.hxx>
42 #include <TDF_Data.hxx>
43 #include <TDF_Label.hxx>
44 #include <stdio.h>
45
46 //SALOMEDS headers
47 #include "SALOMEDS_SComponentIterator_i.hxx"
48 #include "SALOMEDS_ChildIterator_i.hxx"
49 #include "SALOMEDS_StudyBuilder_i.hxx"
50 #include "SALOMEDS_SObject_i.hxx"
51 #include "SALOMEDS_DataMapStringLabel.hxx"
52 #include "SALOMEDS_UseCaseBuilder_i.hxx"
53
54 #include "SALOMEDS_Callback_i.hxx"
55
56 class SALOMEDS_Study_i: public POA_SALOMEDS::Study,
57                         public PortableServer::RefCountServantBase {
58 private:
59   CORBA::ORB_ptr           _orb;
60   char*                    _name;  
61   Handle(TDocStd_Document) _doc;  // OCAF Document
62   CORBA::Boolean           _isSaved; // True if the Study is saved
63   char*                    _URL; //URL of the persistent reference of the study
64   SALOMEDS::SObject_ptr    _FindObject(SALOMEDS::SObject_ptr SO,
65                                        const char* anObjectName,
66                                        bool& _find);
67   SALOMEDS::SObject_ptr    _FindObjectIOR(SALOMEDS::SObject_ptr SO,
68                                           const char* anObjectIOR,
69                                           bool& _find);
70   CORBA::Short             _StudyId;
71
72   SALOMEDS_DataMapStringLabel myIORLabels;
73   TDF_Label                _current;
74   bool                     _autoFill;  
75
76 public:
77
78   //! standard constructor
79   SALOMEDS_Study_i(const Handle(TDocStd_Document), 
80                    CORBA::ORB_ptr, 
81                    const char* study_name);
82   
83   //! standard destructor
84   virtual ~SALOMEDS_Study_i(); 
85   
86   //! method to Get persistent reference of study (idem URL())
87   /*!
88     \sa URL()
89     \return char* arguments, the persistent reference of the study
90   */  
91   virtual char* GetPersistentReference();
92
93
94   //! method to Get transient reference of study
95   /*!
96     \return char* arguments, the transient reference of the study
97   */  
98   virtual char* GetTransientReference();
99
100   //! method to detect if a study is empty
101   /*!
102     \return bool arguments, true if study is empty
103   */  
104   virtual CORBA::Boolean IsEmpty();
105
106   //! method to Find a Component with ComponentDataType = aComponentName
107   /*!
108     \param aComponentName char* arguments
109     \return SComponent_ptr arguments, the component found
110   */  
111   virtual SALOMEDS::SComponent_ptr FindComponent (const char* aComponentName);
112
113   //! method to Find a Component Find a Component from it's ID
114   /*!
115     \param aComponentID char* arguments
116     \return SComponent_ptr arguments, the component found
117   */  
118   virtual SALOMEDS::SComponent_ptr FindComponentID(const char* aComponentID);
119
120   //! method to  Find an Object with SALOMEDS::Name = anObjectName 
121   /*!
122     \param anObjectName char* arguments
123     \return SObject_ptr arguments, the object found
124   */  
125   virtual SALOMEDS::SObject_ptr FindObject(const char* anObjectName);
126
127
128   //! method to Find Object(s) with SALOMEDS::Name = anObjectName in a component with ComponentDataType = aComponentName
129   /*!
130     \param anObjectName char* arguments
131     \param aComponentName char* arguments
132     \return ListOfSObject_ptr arguments, a list of objects found
133   */  
134   
135   virtual SALOMEDS::Study::ListOfSObject* FindObjectByName( const char* anObjectName, const char* aComponentName ) ;
136   
137   //! method to Find an Object with ID = anObjectID 
138   /*!
139     \param anObjectID char* arguments
140     \return SObject_ptr arguments, the object found
141   */  
142   virtual SALOMEDS::SObject_ptr FindObjectID(const char* anObjectID);
143
144   //! method to Find an Object with ID = anObjectIOR 
145   /*!
146     \param anObjectIOR char* arguments
147     \return SObject_ptr arguments, the object found
148   */  
149   virtual SALOMEDS::SObject_ptr FindObjectIOR(const char* anObjectIOR);
150
151   //! method to Find an Object by its path
152   /*!
153     \param thePath char* arguments
154     \return SObject_ptr arguments, the object found
155   */
156   virtual SALOMEDS::SObject_ptr FindObjectByPath(const char* thePath);
157
158   //! method to get a path of SObject
159   /*!
160     \param aSO  SObject_ptr arguments
161     \return char* arguments, the path of the SObject
162   */
163   virtual char* GetObjectPath(CORBA::Object_ptr theObject);
164
165   //! method to set a context: root ('/') is UserData component
166   /*!
167   */
168   virtual void SetContext(const char* thePath);
169
170   //! method to get a context
171   /*!
172   */
173   virtual char* GetContext();  
174
175   //! method to get all object names in the given context (or in the current context, if 'theContext' is empty)
176   /*!
177   */
178   virtual SALOMEDS::ListOfStrings* GetObjectNames(const char* theContext);
179
180   //! method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
181   /*!
182   */
183   virtual SALOMEDS::ListOfStrings* GetDirectoryNames(const char* theContext);
184
185   //! method to get all file names in the given context (or in the current context, if 'theContext' is empty)
186   /*!
187   */
188   virtual SALOMEDS::ListOfStrings* GetFileNames(const char* theContext);
189
190   //! method to get all components names
191   /*!
192   */
193   virtual SALOMEDS::ListOfStrings* GetComponentNames(const char* theContext);
194
195   //! method to Create a ChildIterator from an SObject 
196   /*!
197     \param aSO  SObject_ptr arguments
198     \return ChildIterator_ptr arguments, the created ChildIterator
199   */  
200   virtual SALOMEDS::ChildIterator_ptr NewChildIterator(SALOMEDS::SObject_ptr aSO);
201
202   //! method to Create a SComponentIterator 
203   /*!
204     \return SComponentIterator_ptr arguments, the created SComponentIterator
205   */  
206   virtual SALOMEDS::SComponentIterator_ptr NewComponentIterator();
207
208   //! method to Create a StudyBuilder
209   /*!
210     \return StudyBuilder_ptr arguments, the created StudyBuilder
211   */  
212   virtual SALOMEDS::StudyBuilder_ptr NewBuilder();
213  
214   //! method to get study name
215   /*!
216     \return char* arguments, the study name
217   */
218   virtual char* Name();
219
220   //! method to set study name
221   /*!
222     \param name char* arguments, the study name
223   */
224   virtual void  Name(const char* name);
225
226   //! method to get if study has been saved
227   /*!
228     \return bool arguments
229   */
230   virtual CORBA::Boolean IsSaved();
231
232  //! method to set if study has been saved
233   /*!
234     \param save bool arguments
235   */
236   virtual void  IsSaved(CORBA::Boolean save);
237
238  //! method to Detect if a Study has been modified since it has been saved
239   /*!
240     \return bool arguments
241   */
242   virtual CORBA::Boolean IsModified();
243
244   //! method to get URL of the study (idem GetPersistentReference) 
245   /*!
246     \return char* arguments, the study URL 
247   */
248   virtual char* 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 char* url);
255
256
257   virtual CORBA::Short StudyId();
258   virtual void  StudyId(CORBA::Short id);
259
260   static void IORUpdated(const Handle(SALOMEDS_IORAttribute) theAttribute, CORBA::ORB_ptr orb);
261
262   virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel);
263   
264   virtual SALOMEDS::Study::ListOfSObject* FindDependances(SALOMEDS::SObject_ptr anObject);
265
266   virtual SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties();
267
268   virtual char* GetLastModificationDate();
269
270   virtual SALOMEDS::ListOfDates* GetModificationsDate();
271
272   virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject) {return _orb->object_to_string(theObject); }
273   virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };
274
275   virtual SALOMEDS::UseCaseBuilder_ptr GetUseCaseBuilder();
276
277   virtual void Close();
278
279   void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled) { _autoFill = isEnabled; }
280 };
281 #endif