Salome HOME
NRI : Merge from V1_2.
[modules/visu.git] / src / VISU_I / VISU_Result_i.hh
1 //  Copyright (C) 2003  CEA/DEN, EDF R&D
2 //
3 //
4 //
5 //  File   : VISU_Result_i.hh
6 //  Author : Alexey PETROV
7 //  Module : VISU
8
9 #ifndef __VISU_RESULT_I_H__
10 #define __VISU_RESULT_I_H__
11
12 #include "VISUConfig.hh"
13
14 class vtkUnstructuredGridReader;
15 class vtkUnstructuredGrid;
16 class VISU_Convertor;
17 class FieldInfo;
18 class QAD_Study;
19
20 namespace VISU{
21   class Result_i : public virtual POA_VISU::Result,
22                    public virtual Storable
23   {
24     Result_i();
25     Result_i(const Result_i &);
26   public:
27     Result_i(SALOMEDS::Study_ptr theStudy);
28     virtual ~Result_i();
29
30     virtual VISU::VISUType GetType() { return VISU::TRESULT;};
31
32     typedef VISU_Convertor InputType;
33     typedef vtkUnstructuredGridReader OutputType;
34     enum TSourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
35   private:
36     TSourceId mySourceId;
37     InputType *myInput;
38     string myName;
39     QFileInfo myFileInfo;
40   protected:
41     virtual Storable* Build(SALOMEDS::SObject_ptr theSObject = NULL) 
42       throw (std::runtime_error&);
43   public:
44     virtual Storable* Create(const char* theFileName);
45     virtual Storable* Create(SALOMEDS::SObject_ptr theMedSObject);
46     virtual Storable* Create(SALOME_MED::FIELD_ptr theField);
47     virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
48                               const string& thePrefix, const Storable::TRestoringMap& theMap)
49       throw(std::logic_error&);
50     virtual void ToStream(std::ostringstream& theStr);
51     virtual const char* GetComment() const;
52     static const string myComment;
53     InputType* GetInput();
54     const string& GetName() const { return myName;}
55     const QFileInfo& GetFileInfo() const { return myFileInfo;}
56     Result_i::TSourceId GetSourceId() const { return mySourceId;}
57   private:
58     SALOMEDS::SObject_var mySObject;
59     SALOMEDS::Study_var myStudyDocument;
60     SALOMEDS::SComponent_var mySComponent;
61   public:
62     string GetRefFatherEntry();
63     string GetEntry();
64     const SALOMEDS::SObject_var& GetSObject() const;
65     const SALOMEDS::Study_var& GetStudyDocument() const;
66     const SALOMEDS::SComponent_var& GetSComponent() const;
67   };
68   Storable* ResultRestore(SALOMEDS::SObject_ptr theSObject, 
69                            const string& thePrefix, const Storable::TRestoringMap& theMap)
70     throw(std::logic_error&);
71   Result_var FindResult(SALOMEDS::SObject_ptr theSObject);
72   QString GenerateName(const string& theFmt, int theId);
73   void WriteToFile(vtkUnstructuredGrid* theDataSet, const string& theFileName);
74 }
75 #endif