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