Salome HOME
Moved some functionality to VTKViewer_Utilities.h
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_StudyManager_i.hxx
index de061a44d1e512a8f948c19b7323adc4c2ea8157..a6e4c9e6cb748880cb0603ead29b89cdb3090187 100644 (file)
@@ -1,10 +1,29 @@
-//  File      : SALOMEDS_StudyManager_i.hxx
-//  Created   : Wed Nov 28 16:27:08 2001
-//  Author    : Yves FRICAUD
-
-//  Project   : SALOME
-//  Module    : SALOMEDS
-//  Copyright : Open CASCADE 2001
+//  SALOME SALOMEDS : data structure of SALOME and sources of Salome data server 
+//
+//  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 
+//
+//
+//
+//  File   : SALOMEDS_StudyManager_i.hxx
+//  Author : Yves FRICAUD
+//  Module : SALOME
 //  $Header$
 
 #ifndef __SALOMEDS_STUDYMANAGER_I_H__
 
 // std C++ headers
 #include <iostream.h>
+#include <stdlib.h>
 
 // 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>
+#include <Standard_NotImplemented.hxx>
 
-// Naming Service header
+#include "SALOMEDS_OCAFApplication.hxx"
 #include "SALOME_NamingService.hxx"
 
 // HDF
-#include <iostream.h>
 #include "HDFOI.hxx"
-#include <stdlib.h>
 
-//Standard not implemented
-#include <Standard_NotImplemented.hxx>
+class SALOMEDS_Study_i;
 
+namespace SALOMEDS{
+
+  // To convert IOR from SALOMEDS_IORAttribute to CORBA::Object
+  CORBA::Object_var 
+  GetObject(const TDF_Label&, CORBA::ORB_ptr);
+  
+  // 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 {
-private:
 
-  CORBA::ORB_ptr _orb;
+class SALOMEDS_StudyManager_i: 
+  public virtual POA_SALOMEDS::StudyManager,
+  public virtual PortableServer::RefCountServantBase 
+{
+  SALOMEDS_StudyManager_i(); // Not implemented
+  void operator=(const SALOMEDS_StudyManager_i&); // Not implemented
+
+private:
+  CORBA::ORB_var _orb;
+  PortableServer::POA_var _poa;
+  SALOME_NamingService _name_service;
   Handle (SALOMEDS_OCAFApplication) _OCAFApp;  
-  SALOME_NamingService* _name_service;
-  int _IDcounter;
   Handle(TDocStd_Document) _clipboard;
+  int _IDcounter;
 
   // _SaveAs private function called by Save and SaveAs
-  virtual void _SaveAs(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
+  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);
+  void _SaveObject(SALOMEDS_Study_i* theStudy, 
+                  SALOMEDS::SObject_ptr SC, 
+                  HDFgroup *hdf_group_datatype);
   // _SubstituteSlash function called by Open and GetStudyByName
-  virtual const char *_SubstituteSlash(const char *aUrl);
+  virtual std::string _SubstituteSlash(const char *aUrl);
 
-  virtual void _SaveProperties(SALOMEDS::Study_ptr aStudy, HDFgroup *hdf_group);
+  void _SaveProperties(SALOMEDS_Study_i* theStudy, HDFgroup *hdf_group);
 
 public:
-
   //! standard constructor
-  SALOMEDS_StudyManager_i(CORBA::ORB_ptr orb);
+  SALOMEDS_StudyManager_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA);
 
   //! standard destructor
   virtual  ~SALOMEDS_StudyManager_i(); 
 
+  CORBA::ORB_var GetORB() const { return _orb; }
+
+  PortableServer::POA_var GetPOA() const { return _poa; }
+
+  SALOMEDS_Study_i* DownCast(SALOMEDS::Study_ptr theStudy) const;
+
  //! method to Register study Manager in the naming service
   /*!
     \param char* arguments, the context to register the study manager in the NS
@@ -99,12 +141,15 @@ public:
   */
   virtual void Save( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
 
+  virtual void 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);
 
  //! method to Get name list of open studies in the session
   /*!
@@ -126,16 +171,13 @@ public:
   */ 
   virtual SALOMEDS::Study_ptr GetStudyByID(CORBA::Short aStudyID) ;
 
-
-  Handle(TDocStd_Document) GetDocumentOfStudy(SALOMEDS::Study_ptr theStudy);
-  
-  void CopyLabel(const SALOMEDS::Study_ptr theSourceStudy, 
+  void CopyLabel(SALOMEDS_Study_i* 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,
+  TDF_Label PasteLabel(SALOMEDS_Study_i* theDestinationStudy,
                       const SALOMEDS::Driver_ptr theEngine,
                       const TDF_Label& theSource,
                       const TDF_Label& theDestinationStart,