1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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"
45 #include "SALOMEDS_Driver_i.hxx"
47 #include "SALOMEDSImpl_Study.hxx"
48 #include "SALOMEDSImpl_AttributeIOR.hxx"
50 class Standard_EXPORT SALOMEDS_Study_i: public POA_SALOMEDS::Study
56 SALOMEDSImpl_Study* _impl;
57 SALOMEDS_StudyBuilder_i* _builder;
58 SALOMEDSImpl_AbstractCallback* _notifier;
59 SALOMEDSImpl_AbstractCallback* _genObjRegister;
60 SALOMEDS_DriverFactory_i* _factory;
65 //! standard constructor
66 SALOMEDS_Study_i(CORBA::ORB_ptr);
68 //! standard destructor
70 virtual ~SALOMEDS_Study_i();
72 virtual PortableServer::POA_ptr _default_POA();
77 //! method to Open a Study
79 \param char* arguments, the study URL
80 \return Study_ptr arguments
82 virtual bool Open(const wchar_t* aStudyUrl) throw (SALOME::SALOME_Exception);
84 //! method to save a Study
85 virtual CORBA::Boolean Save(CORBA::Boolean theMultiFile, CORBA::Boolean theASCII);
87 //! method to save a Study to the persistent reference aUrl
89 \param char* arguments, the new URL of the study
91 virtual CORBA::Boolean SaveAs(const wchar_t* aUrl, CORBA::Boolean theMultiFile, CORBA::Boolean theASCII);
93 //! method to copy the object
95 \param theObject object to copy
97 virtual CORBA::Boolean Copy(SALOMEDS::SObject_ptr theObject);
98 virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
99 //! method to paste the object in study
101 \param theObject object to paste
103 virtual SALOMEDS::SObject_ptr Paste(SALOMEDS::SObject_ptr theObject) throw(SALOMEDS::StudyBuilder::LockProtection);
104 virtual CORBA::Boolean CanPaste(SALOMEDS::SObject_ptr theObject);
106 //! method to Get persistent reference of study (idem URL())
109 \return char* arguments, the persistent reference of the study
111 virtual char* GetPersistentReference();
113 //! method to detect if a study is empty
115 \return bool arguments, true if study is empty
117 virtual CORBA::Boolean IsEmpty();
119 //! method to Find a Component with ComponentDataType = aComponentName
121 \param aComponentName char* arguments
122 \return SComponent_ptr arguments, the component found
124 virtual SALOMEDS::SComponent_ptr FindComponent (const char* aComponentName);
126 //! method to Find a Component Find a Component from it's ID
128 \param aComponentID char* arguments
129 \return SComponent_ptr arguments, the component found
131 virtual SALOMEDS::SComponent_ptr FindComponentID(const char* aComponentID);
133 //! method to Find an Object with SALOMEDS::Name = anObjectName
135 \param anObjectName char* arguments
136 \return SObject_ptr arguments, the object found
138 virtual SALOMEDS::SObject_ptr FindObject(const char* anObjectName);
141 //! method to Find Object(s) with SALOMEDS::Name = anObjectName in a component with ComponentDataType = aComponentName
143 \param anObjectName char* arguments
144 \param aComponentName char* arguments
145 \return ListOfSObject_ptr arguments, a list of objects found
148 virtual SALOMEDS::Study::ListOfSObject* FindObjectByName( const char* anObjectName, const char* aComponentName ) ;
150 //! method to Find an Object with ID = anObjectID
152 \param anObjectID char* arguments
153 \return SObject_ptr arguments, the object found
155 virtual SALOMEDS::SObject_ptr FindObjectID(const char* anObjectID);
157 //! method to Create an Object with ID = anObjectID
159 \param anObjectID char* arguments
160 \return SObject_ptr arguments, the object found
162 virtual SALOMEDS::SObject_ptr CreateObjectID(const char* anObjectID);
164 //! method to Find an Object with ID = anObjectIOR
166 \param anObjectIOR char* arguments
167 \return SObject_ptr arguments, the object found
169 virtual SALOMEDS::SObject_ptr FindObjectIOR(const char* anObjectIOR);
171 //! method to Find an Object by its path
173 \param thePath char* arguments
174 \return SObject_ptr arguments, the object found
176 virtual SALOMEDS::SObject_ptr FindObjectByPath(const char* thePath);
178 //! method to get a path of SObject
180 \param aSO SObject_ptr arguments
181 \return char* arguments, the path of the SObject
183 virtual char* GetObjectPath(CORBA::Object_ptr theObject);
185 //! method to Create a ChildIterator from an SObject
187 \param aSO SObject_ptr arguments
188 \return ChildIterator_ptr arguments, the created ChildIterator
190 virtual SALOMEDS::ChildIterator_ptr NewChildIterator(SALOMEDS::SObject_ptr aSO);
192 //! method to Create a SComponentIterator
194 \return SComponentIterator_ptr arguments, the created SComponentIterator
196 virtual SALOMEDS::SComponentIterator_ptr NewComponentIterator();
198 //! method to Create a StudyBuilder
200 \return StudyBuilder_ptr arguments, the created StudyBuilder
202 virtual SALOMEDS::StudyBuilder_ptr NewBuilder();
204 //! method to get study name
206 \return char* arguments, the study name
208 virtual wchar_t* Name();
210 //! method to set study name
212 \param name char* arguments, the study name
214 virtual void Name(const wchar_t* name);
216 //! method to get if study has been saved
218 \return bool arguments
220 virtual CORBA::Boolean IsSaved();
222 //! method to set if study has been saved
224 \param save bool arguments
226 virtual void IsSaved(CORBA::Boolean save);
228 //! method to Detect if a Study has been modified since it has been saved
230 \return bool arguments
232 virtual CORBA::Boolean IsModified();
234 //! method to set Modified flag of a Study to True
235 virtual void Modified();
237 //! method to get URL of the study (idem GetPersistentReference)
239 \return char* arguments, the study URL
241 virtual wchar_t* URL();
243 //! method to set URL of the study
245 \param url char* arguments, the study URL
247 virtual void URL(const wchar_t* url);
249 static void IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute);
251 virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel);
253 virtual SALOMEDS::Study::ListOfSObject* FindDependances(SALOMEDS::SObject_ptr anObject);
255 virtual SALOMEDS::AttributeStudyProperties_ptr GetProperties();
257 virtual char* GetLastModificationDate();
259 virtual SALOMEDS::ListOfDates* GetModificationsDate();
261 virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject) {return _orb->object_to_string(theObject); }
262 virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };
264 virtual SALOMEDS::UseCaseBuilder_ptr GetUseCaseBuilder();
266 void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled);
268 // postponed destroying of CORBA object functionality
269 virtual void AddPostponed(const char* theIOR);
271 virtual void AddCreatedPostponed(const char* theIOR);
273 virtual void RemovePostponed(CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
274 // if theUndoLimit==0, removes all
275 virtual void UndoPostponed(CORBA::Long theWay); // theWay = 1: resurrect objects,
276 // theWay = -1: get back to the list of postponed
278 virtual SALOMEDS::AttributeParameter_ptr GetCommonParameters(const char* theID, CORBA::Long theSavePoint);
279 virtual SALOMEDS::AttributeParameter_ptr GetModuleParameters(const char* theID,
280 const char* theModuleName,
281 CORBA::Long theSavePoint);
283 virtual void SetStudyLock(const char* theLockerID);
285 virtual bool IsStudyLocked();
287 virtual void UnLockStudy(const char* theLockerID);
289 virtual SALOMEDS::ListOfStrings* GetLockerID();
291 virtual void SetReal(const char* theVarName, CORBA::Double theValue);
293 virtual void SetInteger(const char* theVarName, CORBA::Long theValue);
295 virtual void SetBoolean(const char* theVarName, CORBA::Boolean theValue);
297 virtual void SetString(const char* theVarName, const char* theValue);
299 virtual void SetStringAsDouble(const char* theVarName, CORBA::Double theValue);
301 virtual CORBA::Double GetReal(const char* theVarName);
303 virtual CORBA::Long GetInteger(const char* theVarName);
305 virtual CORBA::Boolean GetBoolean(const char* theVarName);
307 virtual char* GetString(const char* theVarName);
309 virtual CORBA::Boolean IsReal(const char* theVarName);
311 virtual CORBA::Boolean IsInteger(const char* theVarName);
313 virtual CORBA::Boolean IsBoolean(const char* theVarName);
315 virtual CORBA::Boolean IsString(const char* theVarName);
317 virtual CORBA::Boolean IsVariable(const char* theVarName);
319 virtual SALOMEDS::ListOfStrings* GetVariableNames();
321 virtual CORBA::Boolean RemoveVariable(const char* theVarName);
323 virtual CORBA::Boolean RenameVariable(const char* theVarName, const char* theNewVarName);
325 virtual CORBA::Boolean IsVariableUsed(const char* theVarName);
327 virtual SALOMEDS::ListOfListOfStrings* ParseVariables(const char* theVars);
329 virtual char* GetDefaultScript(const char* theModuleName, const char* theShift);
331 virtual CORBA::Boolean DumpStudy(const char* thePath,
332 const char* theBaseName,
333 CORBA::Boolean isPublished,
334 CORBA::Boolean isMultiFile);
336 virtual SALOMEDSImpl_Study* GetImpl() { return _impl; }
338 virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
340 static void SetThePOA(PortableServer::POA_ptr);
341 static PortableServer::POA_ptr GetThePOA();
344 CORBA::Long getPID();
345 void ShutdownWithExit();
349 virtual void attach(SALOMEDS::Observer_ptr theObs, CORBA::Boolean modify);
350 virtual void detach(SALOMEDS::Observer_ptr theObs);