Salome HOME
NRI : merge from 1.2c
[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
32 class VISU_Convertor;
33
34 namespace VISU{
35   class Result_i : public virtual POA_VISU::Result,
36                    public virtual Storable
37   {
38     Result_i();
39     Result_i(const Result_i &);
40   public:
41     Result_i(SALOMEDS::Study_ptr theStudy);
42     virtual ~Result_i();
43
44     virtual VISU::VISUType GetType() { return VISU::TRESULT;}
45     virtual CORBA::Boolean BuildAll();
46
47     typedef VISU_Convertor TInput;
48     enum TSourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
49   private:
50     TSourceId mySourceId;
51     TInput *myInput;
52     CORBA::Boolean myIsDone;
53     string myName;
54     QFileInfo myFileInfo;
55   protected:
56     virtual Storable* Build(SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil()) 
57       throw (std::runtime_error&);
58   public:
59     virtual Storable* Create(const char* theFileName);
60     virtual Storable* Create(SALOMEDS::SObject_ptr theMedSObject);
61     virtual Storable* Create(SALOME_MED::FIELD_ptr theField);
62     virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
63                               const Storable::TRestoringMap& theMap, const string& thePrefix)
64       throw(std::logic_error&);
65     static Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
66                              const string& thePrefix, const Storable::TRestoringMap& theMap)
67       throw(std::logic_error&);
68     virtual void ToStream(std::ostringstream& theStr);
69     virtual const char* GetComment() const;
70     static const string myComment;
71     TInput* GetInput();
72     const string& GetName() const { return myName;}
73     const QFileInfo& GetFileInfo() const { return myFileInfo;}
74     Result_i::TSourceId GetSourceId() const { return mySourceId;}
75   private:
76     SALOMEDS::SObject_var mySObject;
77     SALOMEDS::Study_var myStudyDocument;
78     SALOMEDS::SComponent_var mySComponent;
79   public:
80     string GetRefFatherEntry();
81     string GetEntry();
82     const SALOMEDS::SObject_var& GetSObject() const;
83     const SALOMEDS::Study_var& GetStudyDocument() const;
84     const SALOMEDS::SComponent_var& GetSComponent() const;
85   };
86   Result_var FindResult(SALOMEDS::SObject_ptr theSObject);
87 }
88 #endif