Salome HOME
SMH: 3.0.0 preparation - merged and adopted version (POLYWORK+HEAD)
[modules/visu.git] / src / VISU_I / VISU_Result_i.hh
1 //  VISU OBJECT : interactive object for VISU entities implementation
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //  File   : VISU_Result_i.hh
24 //  Author : Alexey PETROV
25 //  Module : VISU
26
27 #ifndef __VISU_RESULT_I_H__
28 #define __VISU_RESULT_I_H__
29
30 #include "VISUConfig.hh"
31 #include "SALOME_GenericObj_i.hh"
32
33 class VISU_Convertor;
34
35 namespace VISU{
36   class Result_i : public virtual POA_VISU::Result,
37                    public virtual Storable,
38                    public virtual SALOME::GenericObj_i
39   {
40     Result_i();
41     Result_i(const Result_i &);
42
43   public:
44     enum ESourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
45     enum ECreationId {eImportFile, eCopyAndImportFile, eImportMed, eImportMedField};
46
47     Result_i(SALOMEDS::Study_ptr theStudy, 
48              const ESourceId& theSourceId,
49              const ECreationId& theCreationId);
50
51     virtual ~Result_i();
52     virtual void RemoveFromStudy();
53
54     virtual VISU::VISUType GetType() { return VISU::TRESULT;}
55     virtual CORBA::Boolean BuildAll();
56
57     typedef VISU_Convertor TInput;
58
59   private:
60     ESourceId mySourceId;
61     ECreationId myCreationId;
62
63     TInput *myInput;
64     CORBA::Boolean myIsDone;
65     std::string myName, myInitFileName;
66     QFileInfo myFileInfo;
67
68   protected:
69     virtual Storable* Build(SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil()) ;
70
71   public:
72     virtual int IsPossible();
73
74     virtual Storable* Create(const char* theFileName);
75     virtual Storable* Create(SALOMEDS::SObject_ptr theMedSObject);
76     virtual Storable* Create(SALOME_MED::FIELD_ptr theField);
77
78     virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
79                               const Storable::TRestoringMap& theMap, 
80                               const std::string& thePrefix);
81
82     static Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
83                              const std::string& thePrefix, 
84                              const Storable::TRestoringMap& theMap);
85
86     virtual void ToStream(std::ostringstream& theStr);
87     virtual const char* GetComment() const;
88     static const std::string myComment;
89     TInput* GetInput();
90
91     const std::string& GetName() const { return myName;}
92     const QFileInfo& GetFileInfo() const { return myFileInfo;}
93     const std::string& GetFileName() const { return myInitFileName;}
94     const ECreationId& GetCreationId() const { return myCreationId;}
95
96   private:
97     SALOMEDS::SObject_var mySObject;
98     SALOMEDS::Study_var myStudyDocument;
99     SALOMEDS::SComponent_var mySComponent;
100     
101   public:
102     std::string GetRefFatherEntry();
103     std::string GetEntry();
104     const SALOMEDS::SObject_var& GetSObject() const;
105     const SALOMEDS::Study_var& GetStudyDocument() const;
106     const SALOMEDS::SComponent_var& GetSComponent() const;
107     std::string GetEntry(const std::string& theComment);
108
109   };
110
111   Result_var FindResult(SALOMEDS::SObject_ptr theSObject);
112   void RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, int theIsAttrOnly = true);
113 }
114
115
116 #endif