1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : SALOMEDS_Study_i.hxx
24 // Author : Sergey RUIN
27 #ifndef __SALOMEDS_STUDY_I_H__
28 #define __SALOMEDS_STUDY_I_H__
34 #include <SALOMEconfig.h>
35 #include CORBA_SERVER_HEADER(SALOME_GenericObj)
36 #include CORBA_SERVER_HEADER(SALOMEDS)
41 #include "SALOMEDS_SComponentIterator_i.hxx"
42 #include "SALOMEDS_StudyBuilder_i.hxx"
43 #include "SALOMEDS_SObject_i.hxx"
44 #include "SALOMEDS_UseCaseBuilder_i.hxx"
46 #include "SALOMEDSImpl_Study.hxx"
47 #include "SALOMEDSImpl_AttributeIOR.hxx"
49 class Standard_EXPORT SALOMEDS_Study_i: public POA_SALOMEDS::Study
53 SALOMEDSImpl_Study* _impl;
54 SALOMEDS_StudyBuilder_i* _builder;
55 static std::map<SALOMEDSImpl_Study*, SALOMEDS_Study_i*> _mapOfStudies;
59 //! standard constructor
60 SALOMEDS_Study_i(SALOMEDSImpl_Study*, CORBA::ORB_ptr);
62 //! standard destructor
63 virtual ~SALOMEDS_Study_i();
65 //! method to Get persistent reference of study (idem URL())
68 \return char* arguments, the persistent reference of the study
70 virtual char* GetPersistentReference();
73 //! method to Get transient reference of study
75 \return char* arguments, the transient reference of the study
77 virtual char* GetTransientReference();
79 //! method to detect if a study is empty
81 \return bool arguments, true if study is empty
83 virtual CORBA::Boolean IsEmpty();
85 //! method to Find a Component with ComponentDataType = aComponentName
87 \param aComponentName char* arguments
88 \return SComponent_ptr arguments, the component found
90 virtual SALOMEDS::SComponent_ptr FindComponent (const char* aComponentName);
92 //! method to Find a Component Find a Component from it's ID
94 \param aComponentID char* arguments
95 \return SComponent_ptr arguments, the component found
97 virtual SALOMEDS::SComponent_ptr FindComponentID(const char* aComponentID);
99 //! method to Find an Object with SALOMEDS::Name = anObjectName
101 \param anObjectName char* arguments
102 \return SObject_ptr arguments, the object found
104 virtual SALOMEDS::SObject_ptr FindObject(const char* anObjectName);
107 //! method to Find Object(s) with SALOMEDS::Name = anObjectName in a component with ComponentDataType = aComponentName
109 \param anObjectName char* arguments
110 \param aComponentName char* arguments
111 \return ListOfSObject_ptr arguments, a list of objects found
114 virtual SALOMEDS::Study::ListOfSObject* FindObjectByName( const char* anObjectName, const char* aComponentName ) ;
116 //! method to Find an Object with ID = anObjectID
118 \param anObjectID char* arguments
119 \return SObject_ptr arguments, the object found
121 virtual SALOMEDS::SObject_ptr FindObjectID(const char* anObjectID);
123 //! method to Create an Object with ID = anObjectID
125 \param anObjectID char* arguments
126 \return SObject_ptr arguments, the object found
128 virtual SALOMEDS::SObject_ptr CreateObjectID(const char* anObjectID);
130 //! method to Find an Object with ID = anObjectIOR
132 \param anObjectIOR char* arguments
133 \return SObject_ptr arguments, the object found
135 virtual SALOMEDS::SObject_ptr FindObjectIOR(const char* anObjectIOR);
137 //! method to Find an Object by its path
139 \param thePath char* arguments
140 \return SObject_ptr arguments, the object found
142 virtual SALOMEDS::SObject_ptr FindObjectByPath(const char* thePath);
144 //! method to get a path of SObject
146 \param aSO SObject_ptr arguments
147 \return char* arguments, the path of the SObject
149 virtual char* GetObjectPath(CORBA::Object_ptr theObject);
151 //! method to set a context: root ('/') is UserData component
154 virtual void SetContext(const char* thePath);
156 //! method to get a context
159 virtual char* GetContext();
161 //! method to get all object names in the given context (or in the current context, if 'theContext' is empty)
164 virtual SALOMEDS::ListOfStrings* GetObjectNames(const char* theContext);
166 //! method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
169 virtual SALOMEDS::ListOfStrings* GetDirectoryNames(const char* theContext);
171 //! method to get all file names in the given context (or in the current context, if 'theContext' is empty)
174 virtual SALOMEDS::ListOfStrings* GetFileNames(const char* theContext);
176 //! method to get all components names
179 virtual SALOMEDS::ListOfStrings* GetComponentNames(const char* theContext);
181 //! method to Create a ChildIterator from an SObject
183 \param aSO SObject_ptr arguments
184 \return ChildIterator_ptr arguments, the created ChildIterator
186 virtual SALOMEDS::ChildIterator_ptr NewChildIterator(SALOMEDS::SObject_ptr aSO);
188 //! method to Create a SComponentIterator
190 \return SComponentIterator_ptr arguments, the created SComponentIterator
192 virtual SALOMEDS::SComponentIterator_ptr NewComponentIterator();
194 //! method to Create a StudyBuilder
196 \return StudyBuilder_ptr arguments, the created StudyBuilder
198 virtual SALOMEDS::StudyBuilder_ptr NewBuilder();
200 //! method to get study name
202 \return char* arguments, the study name
204 virtual char* Name();
206 //! method to set study name
208 \param name char* arguments, the study name
210 virtual void Name(const char* name);
212 //! method to get if study has been saved
214 \return bool arguments
216 virtual CORBA::Boolean IsSaved();
218 //! method to set if study has been saved
220 \param save bool arguments
222 virtual void IsSaved(CORBA::Boolean save);
224 //! method to Detect if a Study has been modified since it has been saved
226 \return bool arguments
228 virtual CORBA::Boolean IsModified();
230 //! method to set Modified flag of a Study to True
231 virtual void Modified();
233 //! method to get URL of the study (idem GetPersistentReference)
235 \return char* arguments, the study URL
239 //! method to set URL of the study
241 \param url char* arguments, the study URL
243 virtual void URL(const char* url);
245 virtual CORBA::Short StudyId();
246 virtual void StudyId(CORBA::Short id);
248 static SALOMEDS::Study_ptr GetStudy(const DF_Label& theLabel, CORBA::ORB_ptr orb);
249 static SALOMEDS_Study_i* GetStudyServant(SALOMEDSImpl_Study*, CORBA::ORB_ptr orb);
251 static void IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute);
253 virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel);
255 virtual SALOMEDS::Study::ListOfSObject* FindDependances(SALOMEDS::SObject_ptr anObject);
257 virtual SALOMEDS::AttributeStudyProperties_ptr GetProperties();
259 virtual char* GetLastModificationDate();
261 virtual SALOMEDS::ListOfDates* GetModificationsDate();
263 virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject) {return _orb->object_to_string(theObject); }
264 virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };
266 virtual SALOMEDS::UseCaseBuilder_ptr GetUseCaseBuilder();
268 virtual void Close();
270 void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled);
272 // postponed destroying of CORBA object functionality
273 virtual void AddPostponed(const char* theIOR);
275 virtual void AddCreatedPostponed(const char* theIOR);
278 virtual void RemovePostponed(const CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
279 // if theUndoLimit==0, removes all
280 virtual void UndoPostponed(const CORBA::Long theWay); // theWay = 1: resurrect objects,
281 // theWay = -1: get back to the list of postponed
283 virtual void RemovePostponed(CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
284 // if theUndoLimit==0, removes all
285 virtual void UndoPostponed(CORBA::Long theWay); // theWay = 1: resurrect objects,
286 // theWay = -1: get back to the list of postponed
289 virtual SALOMEDS::AttributeParameter_ptr GetCommonParameters(const char* theID, CORBA::Long theSavePoint);
290 virtual SALOMEDS::AttributeParameter_ptr GetModuleParameters(const char* theID,
291 const char* theModuleName,
292 CORBA::Long theSavePoint);
294 virtual void SetStudyLock(const char* theLockerID);
296 virtual bool IsStudyLocked();
298 virtual void UnLockStudy(const char* theLockerID);
300 virtual SALOMEDS::ListOfStrings* GetLockerID();
302 virtual void SetReal(const char* theVarName, CORBA::Double theValue);
304 virtual void SetInteger(const char* theVarName, CORBA::Long theValue);
306 virtual void SetBoolean(const char* theVarName, CORBA::Boolean theValue);
308 virtual void SetString(const char* theVarName, const char* theValue);
310 virtual void SetStringAsDouble(const char* theVarName, CORBA::Double theValue);
312 virtual CORBA::Double GetReal(const char* theVarName);
314 virtual CORBA::Long GetInteger(const char* theVarName);
316 virtual CORBA::Boolean GetBoolean(const char* theVarName);
318 virtual char* GetString(const char* theVarName);
320 virtual CORBA::Boolean IsReal(const char* theVarName);
322 virtual CORBA::Boolean IsInteger(const char* theVarName);
324 virtual CORBA::Boolean IsBoolean(const char* theVarName);
326 virtual CORBA::Boolean IsString(const char* theVarName);
328 virtual CORBA::Boolean IsVariable(const char* theVarName);
330 virtual SALOMEDS::ListOfStrings* GetVariableNames();
332 virtual CORBA::Boolean RemoveVariable(const char* theVarName);
334 virtual CORBA::Boolean RenameVariable(const char* theVarName, const char* theNewVarName);
336 virtual CORBA::Boolean IsVariableUsed(const char* theVarName);
338 virtual SALOMEDS::ListOfListOfStrings* ParseVariables(const char* theVars);
340 virtual char* GetDefaultScript(const char* theModuleName, const char* theShift);
342 virtual CORBA::Boolean DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished);
344 virtual SALOMEDSImpl_Study* GetImpl() { return _impl; }
346 virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);