Salome HOME
yfr : merge 1.2
[modules/smesh.git] / src / SMESH_I / SMESH_Gen_i.hxx
1 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
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 //
24 //  File   : SMESH_Gen_i.hxx
25 //  Author : Paul RASCLE, EDF
26 //  Module : SMESH
27 //  $Header$
28
29 #ifndef _SMESH_GEN_I_HXX_
30 #define _SMESH_GEN_I_HXX_
31
32 #include <SALOMEconfig.h>
33 #include CORBA_SERVER_HEADER(SMESH_Gen)
34 #include CORBA_SERVER_HEADER(SMESH_Mesh)
35 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
36 #include CORBA_CLIENT_HEADER(GEOM_Gen)
37 #include CORBA_CLIENT_HEADER(GEOM_Shape)
38 #include CORBA_CLIENT_HEADER(SALOMEDS)
39 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
40
41
42 class SMESH_Mesh_i;
43
44 #include "SMESH_HypothesisFactory_i.hxx"
45 #include "SMESH_Mesh_i.hxx"
46 #include "SALOME_Component_i.hxx"
47 #include "SALOME_NamingService.hxx"
48
49 #include "SMESH_Gen.hxx"
50 #include "SMESH_topo.hxx"
51 #include "GEOM_Client.hxx"
52
53 #include <HDFOI.hxx>
54
55 #include <map>
56
57 typedef struct studyContext_iStruct
58 {
59   map<int,SMESH_Mesh_i*> mapMesh_i;
60 } StudyContext_iStruct;
61
62 class SMESH_Gen_i:
63   public POA_SMESH::SMESH_Gen,
64   public Engines_Component_i 
65 {
66 public:
67
68   SMESH_Gen_i();
69   SMESH_Gen_i(CORBA::ORB_ptr orb,
70               PortableServer::POA_ptr poa,
71               PortableServer::ObjectId * contId, 
72               const char *instanceName, 
73               const char *interfaceName);
74   virtual ~SMESH_Gen_i();
75   
76   SMESH::SMESH_Hypothesis_ptr CreateHypothesis(const char* anHyp,
77                                                CORBA::Long studyId)
78     throw (SALOME::SALOME_Exception);
79   
80   SMESH::SMESH_Mesh_ptr Init(GEOM::GEOM_Gen_ptr geomEngine,
81                              CORBA::Long studyId,
82                              GEOM::GEOM_Shape_ptr aShape)
83     throw (SALOME::SALOME_Exception);
84
85   CORBA::Boolean Compute(SMESH::SMESH_Mesh_ptr aMesh,
86                          GEOM::GEOM_Shape_ptr aShape)
87     throw (SALOME::SALOME_Exception);
88
89   CORBA::Boolean IsReadyToCompute(SMESH::SMESH_Mesh_ptr aMesh,
90                                   GEOM::GEOM_Shape_ptr aShape)
91     throw (SALOME::SALOME_Exception);
92
93   SMESH::long_array* GetSubShapesId(GEOM::GEOM_Gen_ptr geomEngine,
94                                    CORBA::Long studyId,
95                                    GEOM::GEOM_Shape_ptr mainShape,
96                                    const SMESH::shape_array& listOfSubShape)
97     throw (SALOME::SALOME_Exception);
98
99
100   // inherited methods from SALOMEDS::Driver
101
102   SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
103                           const char* theURL,
104                           bool isMultiFile);
105   bool Load(SALOMEDS::SComponent_ptr theComponent,
106             const SALOMEDS::TMPFile& theStream,
107             const char* theURL,
108             bool isMultiFile);
109
110   SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
111                                const char* theURL,
112                                bool isMultiFile);
113   bool LoadASCII(SALOMEDS::SComponent_ptr theComponent,
114                  const SALOMEDS::TMPFile& theStream,
115                  const char* theURL,
116                  bool isMultiFile);
117
118   void Close(SALOMEDS::SComponent_ptr theComponent);
119   char* ComponentDataType();
120     
121   char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
122                                const char* IORString,
123                                CORBA::Boolean isMultiFile,
124                                CORBA::Boolean isASCII);
125   char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
126                                const char* aLocalPersistentID,
127                                CORBA::Boolean isMultiFile,
128                                CORBA::Boolean isASCII);
129
130   bool CanPublishInStudy(CORBA::Object_ptr theIOR) { return false; }
131   SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
132                                        SALOMEDS::SObject_ptr theSObject,
133                                        CORBA::Object_ptr theObject,
134                                        const char* theName) throw (SALOME::SALOME_Exception) {
135     SALOMEDS::SObject_var aResultSO;
136     return aResultSO._retn();
137   }
138
139   CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject) {return false;}
140   SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) {return false;}
141   CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID) {return false;}
142   SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
143                                   CORBA::Long theObjectID,
144                                   SALOMEDS::SObject_ptr theObject) {
145     SALOMEDS::SObject_var aResultSO;
146     return aResultSO._retn();
147   }
148
149   GEOM_Client* _ShapeReader;
150 protected:
151   SMESH_topo* ExploreMainShape(GEOM::GEOM_Gen_ptr geomEngine,
152                                CORBA::Long studyId,
153                                GEOM::GEOM_Shape_ptr aShape);
154   
155 private:
156   SMESH_HypothesisFactory_i _hypothesisFactory_i;
157   ::SMESH_Gen _impl;  // no namespace here
158   int _localId; // unique Id of created objects, within SMESH_Gen_i entity
159
160   map<int, StudyContext_iStruct*> _mapStudyContext_i;
161   map <string, string> _SMESHCorbaObj;
162 };
163
164 #endif