1 // File : SALOMEDS_Study_i.hxx
2 // Created : Wed Nov 28 16:27:37 2001
3 // Author : Yves FRICAUD
7 // Copyright : Open CASCADE 2001
10 #ifndef __SALOMEDS_STUDY_I_H__
11 #define __SALOMEDS_STUDY_I_H__
17 #include <SALOMEconfig.h>
18 #include CORBA_SERVER_HEADER(SALOMEDS)
21 #include <TDocStd_Document.hxx>
22 #include <TDF_Tool.hxx>
23 #include <TDF_Data.hxx>
24 #include <TDF_Label.hxx>
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"
35 #include "SALOMEDS_Callback_i.hxx"
37 class SALOMEDS_Study_i: public POA_SALOMEDS::Study,
38 public PortableServer::RefCountServantBase {
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,
48 SALOMEDS::SObject_ptr _FindObjectIOR(SALOMEDS::SObject_ptr SO,
49 const char* anObjectIOR,
51 CORBA::Short _StudyId;
53 SALOMEDS_DataMapStringLabel myIORLabels;
59 //! standard constructor
60 SALOMEDS_Study_i(const Handle(TDocStd_Document),
62 const char* study_name);
64 //! standard destructor
65 virtual ~SALOMEDS_Study_i();
67 //! method to Get persistent reference of study (idem URL())
70 \return char* arguments, the persistent reference of the study
72 virtual char* GetPersistentReference();
75 //! method to Get transient reference of study
77 \return char* arguments, the transient reference of the study
79 virtual char* GetTransientReference();
81 //! method to detect if a study is empty
83 \return bool arguments, true if study is empty
85 virtual CORBA::Boolean IsEmpty();
87 //! method to Find a Component with ComponentDataType = aComponentName
89 \param aComponentName char* arguments
90 \return SComponent_ptr arguments, the component found
92 virtual SALOMEDS::SComponent_ptr FindComponent (const char* aComponentName);
94 //! method to Find a Component Find a Component from it's ID
96 \param aComponentID char* arguments
97 \return SComponent_ptr arguments, the component found
99 virtual SALOMEDS::SComponent_ptr FindComponentID(const char* aComponentID);
101 //! method to Find an Object with SALOMEDS::Name = anObjectName
103 \param anObjectName char* arguments
104 \return SObject_ptr arguments, the object found
106 virtual SALOMEDS::SObject_ptr FindObject(const char* anObjectName);
109 //! method to Find Object(s) with SALOMEDS::Name = anObjectName in a component with ComponentDataType = aComponentName
111 \param anObjectName char* arguments
112 \param aComponentName char* arguments
113 \return ListOfSObject_ptr arguments, a list of objects found
116 virtual SALOMEDS::Study::ListOfSObject* FindObjectByName( const char* anObjectName, const char* aComponentName ) ;
118 //! method to Find an Object with ID = anObjectID
120 \param anObjectID char* arguments
121 \return SObject_ptr arguments, the object found
123 virtual SALOMEDS::SObject_ptr FindObjectID(const char* anObjectID);
125 //! method to Find an Object with ID = anObjectIOR
127 \param anObjectIOR char* arguments
128 \return SObject_ptr arguments, the object found
130 virtual SALOMEDS::SObject_ptr FindObjectIOR(const char* anObjectIOR);
132 //! method to Find an Object by its path
134 \param thePath char* arguments
135 \return SObject_ptr arguments, the object found
137 virtual SALOMEDS::SObject_ptr FindObjectByPath(const char* thePath);
139 //! method to get a path of SObject
141 \param aSO SObject_ptr arguments
142 \return char* arguments, the path of the SObject
144 virtual char* GetObjectPath(CORBA::Object_ptr theObject);
146 //! method to set a context: root ('/') is UserData component
149 virtual void SetContext(const char* thePath);
151 //! method to get a context
154 virtual char* GetContext();
156 //! method to get all object names in the given context (or in the current context, if 'theContext' is empty)
159 virtual SALOMEDS::ListOfStrings* GetObjectNames(const char* theContext);
161 //! method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
164 virtual SALOMEDS::ListOfStrings* GetDirectoryNames(const char* theContext);
166 //! method to get all file names in the given context (or in the current context, if 'theContext' is empty)
169 virtual SALOMEDS::ListOfStrings* GetFileNames(const char* theContext);
171 //! method to get all components names
174 virtual SALOMEDS::ListOfStrings* GetComponentNames(const char* theContext);
176 //! method to Create a ChildIterator from an SObject
178 \param aSO SObject_ptr arguments
179 \return ChildIterator_ptr arguments, the created ChildIterator
181 virtual SALOMEDS::ChildIterator_ptr NewChildIterator(SALOMEDS::SObject_ptr aSO);
183 //! method to Create a SComponentIterator
185 \return SComponentIterator_ptr arguments, the created SComponentIterator
187 virtual SALOMEDS::SComponentIterator_ptr NewComponentIterator();
189 //! method to Create a StudyBuilder
191 \return StudyBuilder_ptr arguments, the created StudyBuilder
193 virtual SALOMEDS::StudyBuilder_ptr NewBuilder();
195 //! method to get study name
197 \return char* arguments, the study name
199 virtual char* Name();
201 //! method to set study name
203 \param name char* arguments, the study name
205 virtual void Name(const char* name);
207 //! method to get if study has been saved
209 \return bool arguments
211 virtual CORBA::Boolean IsSaved();
213 //! method to set if study has been saved
215 \param save bool arguments
217 virtual void IsSaved(CORBA::Boolean save);
219 //! method to Detect if a Study has been modified since it has been saved
221 \return bool arguments
223 virtual CORBA::Boolean IsModified();
225 //! method to get URL of the study (idem GetPersistentReference)
227 \return char* arguments, the study URL
231 //! method to set URL of the study
233 \param url char* arguments, the study URL
235 virtual void URL(const char* url);
238 virtual CORBA::Short StudyId();
239 virtual void StudyId(CORBA::Short id);
241 static void IORUpdated(const Handle(SALOMEDS_IORAttribute) theAttribute, CORBA::ORB_ptr orb);
243 virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel);
245 virtual SALOMEDS::Study::ListOfSObject* FindDependances(SALOMEDS::SObject_ptr anObject);
247 virtual SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties();
249 virtual char* GetLastModificationDate();
251 virtual SALOMEDS::ListOfDates* GetModificationsDate();
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); };
256 virtual SALOMEDS::UseCaseBuilder_ptr GetUseCaseBuilder();
258 virtual void Close();
260 void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled) { _autoFill = isEnabled; }