Salome HOME
- Deleted Study as an input parameter and class field.
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_Study_i.hxx
index cbee5f615ce5b3cd128e83a046f2d269cd09db27..232b0fb4cadfaaae13362c299e5f5bd91402d9fe 100644 (file)
-//  File      : SALOMEDS_Study_i.hxx
-//  Created   : Wed Nov 28 16:27:37 2001
-//  Author    : Yves FRICAUD
-
-//  Project   : SALOME
-//  Module    : SALOMEDS
-//  Copyright : Open CASCADE 2001
-//  $Header$
-
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  File   : SALOMEDS_Study_i.hxx
+//  Author : Sergey RUIN
+//  Module : SALOME
+//
 #ifndef __SALOMEDS_STUDY_I_H__
 #define __SALOMEDS_STUDY_I_H__
 
 // std C++ headers
-#include <iostream.h>
+#include <iostream>
 
 // IDL headers
 #include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOME_GenericObj)
 #include CORBA_SERVER_HEADER(SALOMEDS)
 
-// Cascade headers
-#include <TDocStd_Document.hxx>
-#include <TDF_Tool.hxx>
-#include <TDF_Data.hxx>
-#include <TDF_Label.hxx>
 #include <stdio.h>
 
 //SALOMEDS headers
 #include "SALOMEDS_SComponentIterator_i.hxx"
-#include "SALOMEDS_ChildIterator_i.hxx"
 #include "SALOMEDS_StudyBuilder_i.hxx"
 #include "SALOMEDS_SObject_i.hxx"
-#include "SALOMEDS_DataMapStringLabel.hxx"
 #include "SALOMEDS_UseCaseBuilder_i.hxx"
+#include "SALOMEDS_Driver_i.hxx"
 
-#include "SALOMEDS_Callback_i.hxx"
+#include "SALOMEDSImpl_Study.hxx"
+#include "SALOMEDSImpl_AttributeIOR.hxx"
 
-class SALOMEDS_Study_i: public POA_SALOMEDS::Study,
-                       public PortableServer::RefCountServantBase {
+class Standard_EXPORT SALOMEDS_Study_i: public POA_SALOMEDS::Study
+{
 private:
-  CORBA::ORB_ptr           _orb;
-  char*                    _name;  
-  Handle(TDocStd_Document) _doc;  // OCAF Document
-  CORBA::Boolean           _isSaved; // True if the Study is saved
-  char*                    _URL; //URL of the persistent reference of the study
-  SALOMEDS::SObject_ptr    _FindObject(SALOMEDS::SObject_ptr SO,
-                                      const char* anObjectName,
-                                      bool& _find);
-  SALOMEDS::SObject_ptr    _FindObjectIOR(SALOMEDS::SObject_ptr SO,
-                                         const char* anObjectIOR,
-                                         bool& _find);
-  CORBA::Short             _StudyId;
-
-  SALOMEDS_DataMapStringLabel myIORLabels;
-  TDF_Label                _current;
-  bool                     _autoFill;  
+
+  void                            NameChanged();
+  CORBA::ORB_var                 _orb;
+  SALOMEDSImpl_Study*            _impl;  
+  SALOMEDS_StudyBuilder_i*       _builder;    
+  SALOMEDSImpl_AbstractCallback* _notifier;
+  SALOMEDSImpl_AbstractCallback* _genObjRegister;
+  SALOMEDS_DriverFactory_i*      _factory;
+  bool                           _closed;
 
 public:
 
   //! standard constructor
-  SALOMEDS_Study_i(const Handle(TDocStd_Document), 
-                  CORBA::ORB_ptr, 
-                  const char* study_name);
+  SALOMEDS_Study_i(CORBA::ORB_ptr);
   
   //! standard destructor
-  virtual ~SALOMEDS_Study_i(); 
+  virtual ~SALOMEDS_Study_i();
   
+  virtual void Init();
+  virtual void Clear();
+
+  //! method to Open a Study
+  /*!
+    \param char* arguments, the study URL
+    \return Study_ptr arguments
+  */
+  virtual bool Open(const char* aStudyUrl) throw (SALOME::SALOME_Exception);
+
+  //! method to save a Study
+  virtual CORBA::Boolean Save(CORBA::Boolean theMultiFile, CORBA::Boolean theASCII);
+
+  //! method to save a Study to the persistent reference aUrl
+  /*!
+    \param char* arguments, the new URL of the study
+  */
+  virtual CORBA::Boolean SaveAs(const char* aUrl, CORBA::Boolean theMultiFile, CORBA::Boolean theASCII);
+
+  //! method to copy the object
+  /*!
+    \param theObject object to copy
+  */
+  virtual CORBA::Boolean Copy(SALOMEDS::SObject_ptr theObject);
+  virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
+  //! method to paste the object in study
+  /*!
+    \param theObject object to paste
+  */
+  virtual SALOMEDS::SObject_ptr Paste(SALOMEDS::SObject_ptr theObject) throw(SALOMEDS::StudyBuilder::LockProtection);
+  virtual CORBA::Boolean CanPaste(SALOMEDS::SObject_ptr theObject);
+
   //! method to Get persistent reference of study (idem URL())
   /*!
     \sa URL()
@@ -71,13 +107,6 @@ public:
   */  
   virtual char* GetPersistentReference();
 
-
-  //! method to Get transient reference of study
-  /*!
-    \return char* arguments, the transient reference of the study
-  */  
-  virtual char* GetTransientReference();
-
   //! method to detect if a study is empty
   /*!
     \return bool arguments, true if study is empty
@@ -122,6 +151,13 @@ public:
   */  
   virtual SALOMEDS::SObject_ptr FindObjectID(const char* anObjectID);
 
+  //! method to Create an Object with ID = anObjectID 
+  /*!
+    \param anObjectID char* arguments
+    \return SObject_ptr arguments, the object found
+  */  
+  virtual SALOMEDS::SObject_ptr CreateObjectID(const char* anObjectID);
+
   //! method to Find an Object with ID = anObjectIOR 
   /*!
     \param anObjectIOR char* arguments
@@ -143,36 +179,6 @@ public:
   */
   virtual char* GetObjectPath(CORBA::Object_ptr theObject);
 
-  //! method to set a context: root ('/') is UserData component
-  /*!
-  */
-  virtual void SetContext(const char* thePath);
-
-  //! method to get a context
-  /*!
-  */
-  virtual char* GetContext();  
-
-  //! method to get all object names in the given context (or in the current context, if 'theContext' is empty)
-  /*!
-  */
-  virtual SALOMEDS::ListOfStrings* GetObjectNames(const char* theContext);
-
-  //! method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
-  /*!
-  */
-  virtual SALOMEDS::ListOfStrings* GetDirectoryNames(const char* theContext);
-
-  //! method to get all file names in the given context (or in the current context, if 'theContext' is empty)
-  /*!
-  */
-  virtual SALOMEDS::ListOfStrings* GetFileNames(const char* theContext);
-
-  //! method to get all components names
-  /*!
-  */
-  virtual SALOMEDS::ListOfStrings* GetComponentNames(const char* theContext);
-
   //! method to Create a ChildIterator from an SObject 
   /*!
     \param aSO  SObject_ptr arguments
@@ -198,12 +204,6 @@ public:
   */
   virtual char* Name();
 
-  //! method to set study name
-  /*!
-    \param name char* arguments, the study name
-  */
-  virtual void  Name(const char* name);
-
   //! method to get if study has been saved
   /*!
     \return bool arguments
@@ -222,6 +222,9 @@ public:
   */
   virtual CORBA::Boolean IsModified();
 
+ //! method to set Modified flag of a Study to True
+  virtual void Modified();
+
   //! method to get URL of the study (idem GetPersistentReference) 
   /*!
     \return char* arguments, the study URL 
@@ -234,17 +237,13 @@ public:
   */
   virtual void  URL(const char* url);
 
-
-  virtual CORBA::Short StudyId();
-  virtual void  StudyId(CORBA::Short id);
-
-  static void IORUpdated(const Handle(SALOMEDS_IORAttribute) theAttribute, CORBA::ORB_ptr orb);
+  static void IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute);
 
   virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel);
   
   virtual SALOMEDS::Study::ListOfSObject* FindDependances(SALOMEDS::SObject_ptr anObject);
 
-  virtual SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties();
+  virtual SALOMEDS::AttributeStudyProperties_ptr GetProperties();
 
   virtual char* GetLastModificationDate();
 
@@ -255,8 +254,87 @@ public:
 
   virtual SALOMEDS::UseCaseBuilder_ptr GetUseCaseBuilder();
 
-  virtual void Close();
+  void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled); 
+
+  // postponed destroying of CORBA object functionality
+  virtual void AddPostponed(const char* theIOR);
+
+  virtual void AddCreatedPostponed(const char* theIOR);
+
+  virtual void RemovePostponed(CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
+                                                        // if theUndoLimit==0, removes all
+  virtual void UndoPostponed(CORBA::Long theWay); // theWay = 1: resurrect objects,
+                                                // theWay = -1: get back to the list of postponed
+
+  virtual SALOMEDS::AttributeParameter_ptr GetCommonParameters(const char* theID, CORBA::Long theSavePoint);
+  virtual SALOMEDS::AttributeParameter_ptr GetModuleParameters(const char* theID, 
+                                                               const char* theModuleName, 
+                                                               CORBA::Long theSavePoint);
+
+  virtual void SetStudyLock(const char* theLockerID);
+
+  virtual bool IsStudyLocked();
+
+  virtual void UnLockStudy(const char* theLockerID);
+
+  virtual SALOMEDS::ListOfStrings* GetLockerID();
+
+  virtual void SetReal(const char* theVarName, CORBA::Double theValue);
+  
+  virtual void SetInteger(const char* theVarName, CORBA::Long theValue);
+
+  virtual void SetBoolean(const char* theVarName, CORBA::Boolean theValue);
+
+  virtual void SetString(const char* theVarName, const char* theValue);
+
+  virtual void SetStringAsDouble(const char* theVarName, CORBA::Double theValue);
+
+  virtual CORBA::Double GetReal(const char* theVarName);
+  
+  virtual CORBA::Long GetInteger(const char* theVarName);
+
+  virtual CORBA::Boolean GetBoolean(const char* theVarName);
+
+  virtual char* GetString(const char* theVarName);
+
+  virtual CORBA::Boolean IsReal(const char* theVarName);
+  
+  virtual CORBA::Boolean IsInteger(const char* theVarName);
+
+  virtual CORBA::Boolean IsBoolean(const char* theVarName);
+
+  virtual CORBA::Boolean IsString(const char* theVarName);
+
+  virtual CORBA::Boolean IsVariable(const char* theVarName);
+
+  virtual SALOMEDS::ListOfStrings* GetVariableNames();
+
+  virtual CORBA::Boolean RemoveVariable(const char* theVarName);
+
+  virtual CORBA::Boolean RenameVariable(const char* theVarName, const char* theNewVarName);
+
+  virtual CORBA::Boolean IsVariableUsed(const char* theVarName);
+  
+  virtual SALOMEDS::ListOfListOfStrings* ParseVariables(const char* theVars);
+
+  virtual char* GetDefaultScript(const char* theModuleName, const char* theShift);
+
+  virtual CORBA::Boolean DumpStudy(const char* thePath,
+                                   const char* theBaseName,
+                                   CORBA::Boolean isPublished,
+                                   CORBA::Boolean isMultiFile);
+
+  virtual SALOMEDSImpl_Study* GetImpl() { return _impl; }
+
+  virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
+
+  void ping(){};
+  CORBA::Long getPID();
+  void ShutdownWithExit();
+
+  void Shutdown();
 
-  void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled) { _autoFill = isEnabled; }
+  virtual void attach(SALOMEDS::Observer_ptr theObs, CORBA::Boolean modify);
+  virtual void detach(SALOMEDS::Observer_ptr theObs);
 };
 #endif