Salome HOME
Fix on Bug PAL7927
[modules/visu.git] / src / VISU_I / VISU_Result_i.hh
index d796d86c3abeb57492396080a17ab39705162893..d172f3f94ec1442b9c41b865635cd200b93b8d31 100644 (file)
@@ -1,5 +1,23 @@
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//  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 
 //
 //
 //  File   : VISU_Result_i.hh
 #define __VISU_RESULT_I_H__
 
 #include "VISUConfig.hh"
+#include "SALOME_GenericObj_i.hh"
 
-class vtkUnstructuredGridReader;
-class vtkUnstructuredGrid;
 class VISU_Convertor;
-class FieldInfo;
-class QAD_Study;
 
 namespace VISU{
   class Result_i : public virtual POA_VISU::Result,
-                   public virtual Storable
+                   public virtual Storable,
+                  public virtual SALOME::GenericObj_i
   {
     Result_i();
     Result_i(const Result_i &);
+
   public:
-    Result_i(SALOMEDS::Study_ptr theStudy);
+    enum TSourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
+    Result_i(SALOMEDS::Study_ptr theStudy, const TSourceId& aSourceId = eFile);
     virtual ~Result_i();
+    virtual void RemoveFromStudy();
 
-    virtual VISU::VISUType GetType() { return VISU::TRESULT;};
+    virtual VISU::VISUType GetType() { return VISU::TRESULT;}
+    virtual CORBA::Boolean BuildAll();
+
+    typedef VISU_Convertor TInput;
 
-    typedef VISU_Convertor InputType;
-    typedef vtkUnstructuredGridReader OutputType;
-    enum TSourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
   private:
     TSourceId mySourceId;
-    InputType *myInput;
-    string myName;
+    TInput *myInput;
+    CORBA::Boolean myIsDone;
+    std::string myName, myInitFileName;
     QFileInfo myFileInfo;
+
   protected:
-    virtual Storable* Build(SALOMEDS::SObject_ptr theSObject = NULL) 
-      throw (std::runtime_error&);
+    virtual Storable* Build(SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil()) ;
+
   public:
+    virtual int IsPossible();
+
     virtual Storable* Create(const char* theFileName);
     virtual Storable* Create(SALOMEDS::SObject_ptr theMedSObject);
     virtual Storable* Create(SALOME_MED::FIELD_ptr theField);
     virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
-                             const string& thePrefix, const Storable::TRestoringMap& theMap)
-      throw(std::logic_error&);
+                             const Storable::TRestoringMap& theMap, const std::string& thePrefix);
+
+    static Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
+                            const std::string& thePrefix, const Storable::TRestoringMap& theMap);
+
     virtual void ToStream(std::ostringstream& theStr);
     virtual const char* GetComment() const;
-    static const string myComment;
-    InputType* GetInput();
-    const string& GetName() const { return myName;}
+    static const std::string myComment;
+    TInput* GetInput();
+    const std::string& GetName() const { return myName;}
     const QFileInfo& GetFileInfo() const { return myFileInfo;}
-    Result_i::TSourceId GetSourceId() const { return mySourceId;}
+    const Result_i::TSourceId& GetSourceId() const { return mySourceId;}
+
   private:
     SALOMEDS::SObject_var mySObject;
     SALOMEDS::Study_var myStudyDocument;
     SALOMEDS::SComponent_var mySComponent;
+    
   public:
-    string GetRefFatherEntry();
-    string GetEntry();
+    std::string GetRefFatherEntry();
+    std::string GetEntry();
     const SALOMEDS::SObject_var& GetSObject() const;
     const SALOMEDS::Study_var& GetStudyDocument() const;
     const SALOMEDS::SComponent_var& GetSComponent() const;
+    std::string GetEntry(const std::string& theComment);
+
   };
-  Storable* ResultRestore(SALOMEDS::SObject_ptr theSObject, 
-                          const string& thePrefix, const Storable::TRestoringMap& theMap)
-    throw(std::logic_error&);
+
   Result_var FindResult(SALOMEDS::SObject_ptr theSObject);
-  QString GenerateName(const string& theFmt, int theId);
-  void WriteToFile(vtkUnstructuredGrid* theDataSet, const string& theFileName);
+  void RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, int theIsAttrOnly = true);
 }
 #endif