Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/visu.git] / src / VISU_I / VISUConfig.hh
index 895ee9592caa1d2a82fb3ecc8270523dba88cfab..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 
+//  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 
+//  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 <map>
-#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>
+#include "SALOMEDSClient_SObject.hxx"
+#include "SALOMEDSClient_Study.hxx"
 
-#include <stdexcept>
+// 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>
 
 class SUIT_Session;
 class SUIT_ResourceMgr;
 
-
-namespace VISU{
+namespace VISU
+{
 
   SUIT_Session *GetSession();
   SUIT_ResourceMgr *GetResourceMgr();
@@ -116,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<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 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);
@@ -129,6 +132,13 @@ 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();
@@ -141,26 +151,32 @@ namespace VISU{
   _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, 
+  std::string CreateAttributes(_PTR(Study) 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 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) );
-}
 
+  SALOMEDS::SObject_var GetSObject(_PTR(SObject));
+  _PTR(SObject) GetClientSObject(SALOMEDS::SObject_var, _PTR(Study));
 
-#endif
+  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