Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/visu.git] / src / VISU_I / VISUConfig.hh
index ba38a0ee54365508edd7c3e155acda547c736128..3e835d714e58f7d9fb3d00b04597e2af981dccb8 100644 (file)
@@ -1,23 +1,23 @@
 //  VISU OBJECT : interactive object for VISU entities implementation
 //
 //  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 
+//  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   : VISUConfig.hh
 #ifndef __VISU_CONFIG_H__
 #define __VISU_CONFIG_H__
 
-// standard C++ headers
-#include <stdio.h>
-#include <iostream>
-#include <string>
-#include <qstring.h> 
-#include <qthread.h> 
-#include <qfileinfo.h>
-#include <qapplication.h>
-
 // IDL headers
 #include "SALOMEconfig.h"
 #include CORBA_SERVER_HEADER(VISU_Gen)
 #include CORBA_SERVER_HEADER(MED)
 #include CORBA_SERVER_HEADER(SALOMEDS)
 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
 #include "SALOME_NamingService.hxx"
 #include "SALOME_LifeCycleCORBA.hxx"
 #include "Utils_CorbaException.hxx"
 #include "utilities.h"
 
+#include "SALOMEDSClient_SObject.hxx"
+#include "SALOMEDSClient_Study.hxx"
+
+// QT headers
+#include <qstring.h>
+#include <qthread.h>
+#include <qfileinfo.h>
+#include <qapplication.h>
+
+// standard C++ headers
+#include <stdio.h>
+
+// STL headers
+#include <map>
+#include <string>
+#include <sstream>
+#include <iostream>
 #include <stdexcept>
-#include <sstream>     
 
-namespace VISU{
+class SUIT_Session;
+class SUIT_ResourceMgr;
+
+namespace VISU
+{
+
+  SUIT_Session *GetSession();
+  SUIT_ResourceMgr *GetResourceMgr();
+
   //===========================================================================
+
   class VISU_Gen_i;
 
   class Base_i : public virtual POA_VISU::Base,
@@ -101,12 +118,13 @@ namespace VISU{
     std::string ToString();
     virtual const char* GetComment() const = 0;
     typedef std::map<std::string,QString> TRestoringMap;
-    typedef Storable* (*TStorableEngine)(SALOMEDS::SObject_ptr theSObject, 
+    typedef Storable* (*TStorableEngine)(SALOMEDS::SObject_ptr theSObject,
                                         const std::string& thePrefix, const TRestoringMap& theMap);
-    typedef std::map<string,TStorableEngine> TCallbackMap;
+    typedef std::map<std::string,TStorableEngine> TCallbackMap;
     static void Registry(const char* theComment, TStorableEngine theEngine);
-    static Storable* Create(SALOMEDS::SObject_ptr, const std::string& thePrefix, const std::string& theString); 
-    static const QString& FindValue(const TRestoringMap& theMap, const std::string& theArg, bool* isFind = NULL);
+    static Storable* Create(SALOMEDS::SObject_ptr, const std::string& thePrefix, const std::string& theString);
+    static QString FindValue(const TRestoringMap& theMap, const std::string& theArg, bool* isFind = NULL);
+    static QString FindValue(const TRestoringMap& theMap, const std::string& theArg, const QString& theDefaultValue);
     static void StrToMap(const QString& theStr, VISU::Storable::TRestoringMap& theMap);
     static SALOMEDS::SObject_ptr GetResultSO(SALOMEDS::SObject_ptr theSObject);
     static void DataToStream(std::ostringstream& theStr, const QString& theName, const QString& theVal);
@@ -114,24 +132,51 @@ namespace VISU{
     static void DataToStream(std::ostringstream& theStr, const QString& theName, const double theVal);
   };
 
+  //===========================================================================
+  class RemovableObject_i : public virtual POA_VISU::RemovableObject,
+                            public virtual Storable
+  {
+  public:
+    virtual void RemoveFromStudy() = 0;
+  };
 
   //===========================================================================
   const CORBA::Boolean IsMultifile();
-  QString GenerateName(const string& theFmt, int theId);
+  QString GenerateName(const std::string& theFmt, int theId);
 
   PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject);
-  CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject);
+  CORBA::Object_var ClientSObjectToObject(_PTR(SObject) theSObject);
+  CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr);
 
+  _PTR(SComponent) ClientFindOrCreateVisuComponent(_PTR(Study) theStudyDocument);
   SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument);
 
-  std::string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument, 
+  std::string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument,
                               const char* theFatherEntry, const char* theRefFatherEntry,
-                              const char* theIOR, const char* theName, 
+                              const char* theIOR, const char* theName,
+                              const char* thePersistentRef, const char* theComment,
+                              CORBA::Boolean theCreateNew = true);
+
+  std::string CreateAttributes(_PTR(Study) theStudyDocument,
+                              const char* theFatherEntry, const char* theRefFatherEntry,
+                              const char* theIOR, const char* theName,
                               const char* thePersistentRef, const char* theComment,
                               CORBA::Boolean theCreateNew = true);
 
   std::string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry,
                                   const char* theComment, int IsAllLevels = true);
+
+  SALOMEDS::SObject_var GetSObject(_PTR(SObject));
+  _PTR(SObject) GetClientSObject(SALOMEDS::SObject_var, _PTR(Study));
+
+  SALOMEDS::Study_var GetDSStudy(_PTR(Study));
+
+  void RemoveFromStudy(SALOMEDS::SObject_ptr theSObject,
+                      bool theIsAttrOnly = true,
+                      bool theDestroySubObjects = false);
+  void RemoveFromStudy(_PTR(SObject) theSObject,
+                      bool theIsAttrOnly = true,
+                      bool theDestroySubObjects = false);
 }
 
 #endif