Salome HOME
Merge branch 'master' into agr/start_procedure
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_StudyManager_i.hxx
index 2c45ce203061f643c6d8b06ee17aeaaa0ce0c57e..0e0748c507274d92b9e19eb14de99ec734a86ee3 100644 (file)
@@ -1,89 +1,72 @@
-//  SALOME SALOMEDS : data structure of SALOME and sources of Salome data server 
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003  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. 
-// 
-//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+// 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_StudyManager_i.hxx
-//  Author : Yves FRICAUD
+//  Author : Sergey RUIN
 //  Module : SALOME
-//  $Header$
-
+//
 #ifndef __SALOMEDS_STUDYMANAGER_I_H__
 #define __SALOMEDS_STUDYMANAGER_I_H__
 
 // std C++ headers
-#include <iostream.h>
+#include <iostream>
+
+#ifndef WIN32
+#include <unistd.h>
+#endif
 
 // IDL headers
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SALOMEDS)
 
-// Cascade headers
-#include "SALOMEDS_OCAFApplication.hxx"
-#include <TDocStd_Document.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDataStd_Name.hxx>
-#include <TDF_Label.hxx>
-#include <TDocStd_Document.hxx>
-
 // Naming Service header
 #include "SALOME_NamingService.hxx"
 
-// HDF
-#include <iostream.h>
-#include "HDFOI.hxx"
 #include <stdlib.h>
 
-//Standard not implemented
-#include <Standard_NotImplemented.hxx>
+#include "SALOMEDS_Driver_i.hxx"
+#include "SALOMEDSImpl_StudyManager.hxx"
+
+namespace SALOMEDS{
+
+  // To convert CORBA::Object to  PortableServer::ServantBase
+  PortableServer::ServantBase_var GetServant(CORBA::Object_ptr, PortableServer::POA_ptr);
 
+}    
 
-class SALOMEDS_StudyManager_i: public POA_SALOMEDS::StudyManager,
-                              public PortableServer::RefCountServantBase {
+class Standard_EXPORT SALOMEDS_StudyManager_i: public POA_SALOMEDS::StudyManager
+{
 private:
 
-  CORBA::ORB_ptr _orb;
-  Handle (SALOMEDS_OCAFApplication) _OCAFApp;  
-  SALOME_NamingService* _name_service;
-  int _IDcounter;
-  Handle(TDocStd_Document) _clipboard;
-
-  // _SaveAs private function called by Save and SaveAs
-  virtual void _SaveAs(const char* aUrl,
-                      SALOMEDS::Study_ptr aStudy,
-                      CORBA::Boolean theMultiFile,
-                      CORBA::Boolean theASCII);
-  // _SaveObject private function called by _SaveAs
-  virtual void _SaveObject(SALOMEDS::Study_ptr aStudy, 
-                          SALOMEDS::SObject_ptr SC, 
-                          HDFgroup *hdf_group_datatype);
-  // _SubstituteSlash function called by Open and GetStudyByName
-  virtual const char *_SubstituteSlash(const char *aUrl);
-
-  virtual void _SaveProperties(SALOMEDS::Study_ptr aStudy, HDFgroup *hdf_group);
+  CORBA::ORB_var                    _orb;
+  PortableServer::POA_var           _poa;
+  SALOMEDSImpl_StudyManager*        _impl;  
+  SALOME_NamingService*             _name_service;
+  SALOMEDS_DriverFactory_i*         _factory; 
 
 public:
 
   //! standard constructor
-  SALOMEDS_StudyManager_i(CORBA::ORB_ptr orb);
+  SALOMEDS_StudyManager_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr thePOA);
 
   //! standard destructor
   virtual  ~SALOMEDS_StudyManager_i(); 
@@ -92,7 +75,7 @@ public:
   /*!
     \param char* arguments, the context to register the study manager in the NS
   */  
-  void register_name(char * name);
+  void register_name(const char * name);
   
  //! method to Create a New Study of name study_name
   /*!
@@ -119,17 +102,17 @@ public:
   /*!
     \param Study_ptr arguments
   */
-  virtual void Save( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
+  virtual CORBA::Boolean Save( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
 
-  virtual void SaveASCII( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
+  virtual CORBA::Boolean SaveASCII( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
 
   //! method to save a Study to the persistent reference aUrl
   /*!
     \param char* arguments, the new URL of the study
     \param Study_ptr arguments
   */
-  virtual void SaveAs(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
-  virtual void SaveAsASCII(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
+  virtual CORBA::Boolean SaveAs(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
+  virtual CORBA::Boolean SaveAsASCII(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
 
  //! method to Get name list of open studies in the session
   /*!
@@ -150,29 +133,26 @@ public:
     \return Study_ptr arguments
   */ 
   virtual SALOMEDS::Study_ptr GetStudyByID(CORBA::Short aStudyID) ;
-
-
-  Handle(TDocStd_Document) GetDocumentOfStudy(SALOMEDS::Study_ptr theStudy);
-  
-  void CopyLabel(const SALOMEDS::Study_ptr theSourceStudy, 
-                const SALOMEDS::Driver_ptr theEngine,
-                const Standard_Integer theSourceStartDepth,
-                const TDF_Label& theSource,
-                const TDF_Label& theDestinationMain);
-
-  TDF_Label PasteLabel(const SALOMEDS::Study_ptr theDestinationStudy,
-                      const SALOMEDS::Driver_ptr theEngine,
-                      const TDF_Label& theSource,
-                      const TDF_Label& theDestinationStart,
-                      const int theCopiedStudyID,
-                      const bool isFirstElement);
   
   virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
   virtual CORBA::Boolean Copy(SALOMEDS::SObject_ptr theObject);
   virtual CORBA::Boolean CanPaste(SALOMEDS::SObject_ptr theObject);
   virtual SALOMEDS::SObject_ptr Paste(SALOMEDS::SObject_ptr theObject) throw(SALOMEDS::StudyBuilder::LockProtection);
+
+  virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject) {return _orb->object_to_string(theObject); }
+  virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };  
   
   void ping(){};
+  CORBA::Long getPID();
+  void ShutdownWithExit();
+
+  virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
+
+  static PortableServer::POA_ptr GetPOA(const SALOMEDS::Study_ptr theStudy);
+
+  void Shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); }
+
+  virtual SALOMEDS::SimanStudy_ptr GetSimanStudy();
 };
 
 #endif