Salome HOME
MPV: Merge V1_2d
[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 TSourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
45     Result_i(SALOMEDS::Study_ptr theStudy, const TSourceId& aSourceId = eFile);
46     virtual ~Result_i();
47     virtual void RemoveFromStudy();
48
49     virtual VISU::VISUType GetType() { return VISU::TRESULT;}
50     virtual CORBA::Boolean BuildAll();
51
52     typedef VISU_Convertor TInput;
53
54   private:
55     TSourceId mySourceId;
56     TInput *myInput;
57     CORBA::Boolean myIsDone;
58     string myName, myInitFileName;
59     QFileInfo myFileInfo;
60
61   protected:
62     virtual Storable* Build(SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil()) 
63       throw (std::runtime_error&);
64
65   public:
66     virtual int IsPossible();
67
68     virtual Storable* Create(const char* theFileName);
69     virtual Storable* Create(SALOMEDS::SObject_ptr theMedSObject);
70     virtual Storable* Create(SALOME_MED::FIELD_ptr theField);
71     virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
72                               const Storable::TRestoringMap& theMap, const string& thePrefix)
73       throw(std::logic_error&);
74     static Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
75                              const string& thePrefix, const Storable::TRestoringMap& theMap)
76       throw(std::logic_error&);
77     virtual void ToStream(std::ostringstream& theStr);
78     virtual const char* GetComment() const;
79     static const string myComment;
80     TInput* GetInput();
81     const string& GetName() const { return myName;}
82     const QFileInfo& GetFileInfo() const { return myFileInfo;}
83     const Result_i::TSourceId& GetSourceId() const { return mySourceId;}
84
85   private:
86     SALOMEDS::SObject_var mySObject;
87     SALOMEDS::Study_var myStudyDocument;
88     SALOMEDS::SComponent_var mySComponent;
89
90   public:
91     string GetRefFatherEntry();
92     string GetEntry();
93     const SALOMEDS::SObject_var& GetSObject() const;
94     const SALOMEDS::Study_var& GetStudyDocument() const;
95     const SALOMEDS::SComponent_var& GetSComponent() const;
96
97   };
98
99   Result_var FindResult(SALOMEDS::SObject_ptr theSObject);
100   void RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, int theIsAttrOnly = true);
101 }
102 #endif