Salome HOME
fb00207992e089fa874fbee79ef6eaa0cbfb2b2e
[modules/smesh.git] / src / SMESH_I / SMESH_Gen_i.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
23 //  File   : SMESH_Gen_i.hxx
24 //  Author : Paul RASCLE, EDF
25 //  Module : SMESH
26 //
27 #ifndef _SMESH_GEN_I_HXX_
28 #define _SMESH_GEN_I_HXX_
29
30 #include "SMESH.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(SALOMEDS)
38 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
39
40 #include "SMESH_Mesh_i.hxx"
41 #include "SMESH_Hypothesis_i.hxx"
42 #include "SALOME_Component_i.hxx"
43 #include "SALOME_NamingService.hxx"
44
45 #include "SMESH_Gen.hxx"
46 #include "GEOM_Client.hxx"
47
48 #include <TCollection_AsciiString.hxx>
49 #include <Resource_DataMapOfAsciiStringAsciiString.hxx>
50 #include <TColStd_HSequenceOfAsciiString.hxx>
51
52 #include <map>
53 #include <sstream>
54
55 class SMESH_Mesh_i;
56 class SALOME_LifeCycleCORBA;
57
58 // ===========================================================
59 // Study context - stores study-connected objects references
60 // ==========================================================
61 class SMESH_I_EXPORT StudyContext
62 {
63 public:
64   // constructor
65   StudyContext() {}
66   // destructor
67   ~StudyContext() 
68   { 
69     mapIdToIOR.clear();
70     mapIdToId.clear();
71   }
72   // register object in the internal map and return its id
73   int addObject( string theIOR )
74   {
75     int nextId = getNextId();
76     mapIdToIOR[ nextId ]  = theIOR;
77     return nextId;
78   }
79   // find the object id in the internal map by the IOR
80   int findId( string theIOR )
81   {
82     map<int, string>::iterator imap;
83     for ( imap = mapIdToIOR.begin(); imap != mapIdToIOR.end(); ++imap ) {
84       if ( imap->second == theIOR )
85         return imap->first;
86     }
87     return 0;
88   }
89   // get object's IOR by id
90   string getIORbyId( const int theId )
91   {
92     if ( mapIdToIOR.find( theId ) != mapIdToIOR.end() )
93       return mapIdToIOR[ theId ];
94     return string( "" );
95   }
96   // get object's IOR by old id
97   string getIORbyOldId( const int theOldId )
98   {
99     if ( mapIdToId.find( theOldId ) != mapIdToId.end() )
100       return getIORbyId( mapIdToId[ theOldId ] );
101     return string( "" );
102   }
103   // maps old object id to the new one (used when restoring data)
104   void mapOldToNew( const int oldId, const int newId ) {
105     if ( mapIdToIOR.find( newId ) != mapIdToIOR.end() ) {
106       mapIdToIOR[ oldId ] = mapIdToIOR[ newId ];
107       mapIdToIOR.erase( newId );
108     }
109     mapIdToId[ oldId ] = oldId;
110   }
111   // get old id by a new one
112   int getOldId( const int newId ) {
113     map<int, int>::iterator imap;
114     for ( imap = mapIdToId.begin(); imap != mapIdToId.end(); ++imap ) {
115       if ( imap->second == newId )
116         return imap->first;
117     }
118     return 0;
119   }
120     
121 private:
122   // get next free object identifier
123   int getNextId()
124   {
125     int id = 1;
126     while( mapIdToIOR.find( id ) != mapIdToIOR.end() )
127       id++;
128     return id;
129   }
130
131   map<int, string> mapIdToIOR;      // persistent-to-transient map
132   map<int, int>    mapIdToId;       // used to translate object from persistent to transient form
133 };
134
135 // ===========================================================
136 // SMESH module's engine
137 // ==========================================================
138 class SMESH_I_EXPORT SMESH_Gen_i:
139   public virtual POA_SMESH::SMESH_Gen,
140   public virtual Engines_Component_i 
141 {
142 public:
143   // Get last created instance of the class
144   static SMESH_Gen_i* GetSMESHGen() { return mySMESHGen;}
145   // Get ORB object
146   static CORBA::ORB_var GetORB() { return myOrb;}
147   // Get SMESH module's POA object
148   static PortableServer::POA_var GetPOA() { return myPoa;}
149   // Get Naming Service object
150   static SALOME_NamingService* GetNS();
151   // Get SALOME_LifeCycleCORBA object
152   static SALOME_LifeCycleCORBA* GetLCC();
153   // Retrieve and get GEOM engine reference
154   static GEOM::GEOM_Gen_ptr GetGeomEngine();
155   // Get object of the CORBA reference
156   static PortableServer::ServantBase_var GetServant( CORBA::Object_ptr theObject );
157   // Get CORBA object corresponding to the SALOMEDS::SObject
158   static CORBA::Object_var SObjectToObject( SALOMEDS::SObject_ptr theSObject );
159   // Get the SALOMEDS::SObject corresponding to a CORBA object
160   static SALOMEDS::SObject_ptr ObjectToSObject(SALOMEDS::Study_ptr theStudy,
161                                                CORBA::Object_ptr   theObject);
162   // Get GEOM Object correspoding to TopoDS_Shape
163   GEOM::GEOM_Object_ptr ShapeToGeomObject (const TopoDS_Shape& theShape );
164   // Get TopoDS_Shape correspoding to GEOM_Object
165   TopoDS_Shape GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject);
166   
167   // Default constructor
168   SMESH_Gen_i();
169   // Standard constructor
170   SMESH_Gen_i( CORBA::ORB_ptr            orb,
171                PortableServer::POA_ptr   poa,
172                PortableServer::ObjectId* contId, 
173                const char*               instanceName, 
174                const char*               interfaceName );
175   // Destructor
176   virtual ~SMESH_Gen_i();
177
178   // *****************************************
179   // Interface methods
180   // *****************************************
181   // Set a new Mesh object name
182   void SetName(const char* theIOR,
183                const char* theName);
184
185   //GEOM::GEOM_Gen_ptr SetGeomEngine( const char* containerLoc );
186   void SetGeomEngine( GEOM::GEOM_Gen_ptr geomcompo );
187
188   // Set current study
189   void SetEmbeddedMode( CORBA::Boolean theMode );
190   // Get current study
191   CORBA::Boolean IsEmbeddedMode();
192
193   // Set current study
194   void SetCurrentStudy( SALOMEDS::Study_ptr theStudy );
195   // Get current study
196   SALOMEDS::Study_ptr GetCurrentStudy();
197
198   // Create hypothesis/algorothm of given type
199   SMESH::SMESH_Hypothesis_ptr CreateHypothesis (const char* theHypType,
200                                                 const char* theLibName)
201     throw ( SALOME::SALOME_Exception );
202   
203   // Return hypothesis of given type holding parameter values of the existing mesh
204   SMESH::SMESH_Hypothesis_ptr GetHypothesisParameterValues (const char*           theHypType,
205                                                             const char*           theLibName,
206                                                             SMESH::SMESH_Mesh_ptr theMesh,
207                                                             GEOM::GEOM_Object_ptr theGeom,
208                                                             CORBA::Boolean        byMesh)
209     throw ( SALOME::SALOME_Exception );
210   
211   /*!
212    * Sets number of segments per diagonal of boundary box of geometry by which
213    * default segment length of appropriate 1D hypotheses is defined
214    */
215   void SetBoundaryBoxSegmentation( CORBA::Long theNbSegments ) throw ( SALOME::SALOME_Exception );
216   /*!
217    * \brief Sets default number of segments per edge
218    */
219   void SetDefaultNbSegments(CORBA::Long theNbSegments) throw ( SALOME::SALOME_Exception );
220
221   // Create empty mesh on a shape
222   SMESH::SMESH_Mesh_ptr CreateMesh( GEOM::GEOM_Object_ptr theShapeObject )
223     throw ( SALOME::SALOME_Exception );
224
225   // Create empty mesh
226   SMESH::SMESH_Mesh_ptr CreateEmptyMesh()
227     throw ( SALOME::SALOME_Exception );
228
229   //  Create mesh(es) and import data from UNV file
230   SMESH::SMESH_Mesh_ptr CreateMeshesFromUNV( const char* theFileName )
231     throw ( SALOME::SALOME_Exception );
232
233   //  Create mesh(es) and import data from MED file
234   SMESH::mesh_array* CreateMeshesFromMED( const char* theFileName,
235                                           SMESH::DriverMED_ReadStatus& theStatus )
236     throw ( SALOME::SALOME_Exception );
237
238   //  Create mesh(es) and import data from STL file
239   SMESH::SMESH_Mesh_ptr CreateMeshesFromSTL( const char* theFileName )
240     throw ( SALOME::SALOME_Exception );
241
242   // Compute mesh on a shape
243   CORBA::Boolean Compute( SMESH::SMESH_Mesh_ptr theMesh,
244                           GEOM::GEOM_Object_ptr theShapeObject )
245     throw ( SALOME::SALOME_Exception );
246   /*!
247    * \brief Return errors of mesh computation
248    */
249   SMESH::compute_error_array* GetComputeErrors(SMESH::SMESH_Mesh_ptr theMesh,
250                                                GEOM::GEOM_Object_ptr  theShapeObject )
251     throw ( SALOME::SALOME_Exception );
252
253   /*!
254    * Evaluate mesh on a shape and
255    *  returns statistic of mesh elements
256    * Result array of number enityties
257    */
258   SMESH::long_array* Evaluate(SMESH::SMESH_Mesh_ptr theMesh,
259                               GEOM::GEOM_Object_ptr theShapeObject)
260     throw ( SALOME::SALOME_Exception );
261
262   // Returns true if mesh contains enough data to be computed
263   CORBA::Boolean IsReadyToCompute( SMESH::SMESH_Mesh_ptr theMesh,
264                                    GEOM::GEOM_Object_ptr theShapeObject )
265     throw ( SALOME::SALOME_Exception );
266   
267   /*!
268    * Calculate Mesh as preview till indicated dimension on shape
269    * First, verify list of hypothesis associated with the subShape.
270    * Return mesh preview structure
271    */
272   SMESH::MeshPreviewStruct* Precompute( SMESH::SMESH_Mesh_ptr theMesh,
273                                         GEOM::GEOM_Object_ptr theSubObject,
274                                         SMESH::Dimension      theDimension,
275                                         SMESH::long_array&    theShapesId )
276     throw ( SALOME::SALOME_Exception );
277
278   // Returns errors of hypotheses definintion
279   SMESH::algo_error_array* GetAlgoState( SMESH::SMESH_Mesh_ptr theMesh, 
280                                          GEOM::GEOM_Object_ptr theSubObject )
281       throw ( SALOME::SALOME_Exception );
282
283   // Return mesh elements preventing computation of a subshape
284   SMESH::MeshPreviewStruct* GetBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
285                                                  CORBA::Short          theSubShapeID )
286     throw ( SALOME::SALOME_Exception );
287
288   // Get sub-shapes unique ID's list
289   SMESH::long_array* GetSubShapesId( GEOM::GEOM_Object_ptr      theMainShapeObject,
290                                      const SMESH::object_array& theListOfSubShape )
291     throw ( SALOME::SALOME_Exception );
292
293   // Return geometrical object the given element is built on. Publish it in study.
294   GEOM::GEOM_Object_ptr GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr  theMesh,
295                                                   CORBA::Long            theElementID,
296                                                   const char*            theGeomName)
297     throw ( SALOME::SALOME_Exception );
298
299   // Return geometrical object the given element is built on. Don't publish it in study.
300   GEOM::GEOM_Object_ptr FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr  theMesh,
301                                                    CORBA::Long            theElementID)
302     throw ( SALOME::SALOME_Exception );
303
304   // Concatenate the given meshes into one mesh
305   SMESH::SMESH_Mesh_ptr ConcatenateCommon(const SMESH::mesh_array& theMeshesArray, 
306                                           CORBA::Boolean           theUniteIdenticalGroups, 
307                                           CORBA::Boolean           theMergeNodesAndElements, 
308                                           CORBA::Double            theMergeTolerance,
309                                           CORBA::Boolean           theCommonGroups)
310     throw ( SALOME::SALOME_Exception );
311
312   // Concatenate the given meshes into one mesh
313   SMESH::SMESH_Mesh_ptr Concatenate(const SMESH::mesh_array& theMeshesArray, 
314                                     CORBA::Boolean           theUniteIdenticalGroups, 
315                                     CORBA::Boolean           theMergeNodesAndElements, 
316                                     CORBA::Double            theMergeTolerance)
317     throw ( SALOME::SALOME_Exception );
318
319   // Concatenate the given meshes into one mesh
320   // Create the groups of all elements from initial meshes
321   SMESH::SMESH_Mesh_ptr ConcatenateWithGroups(const SMESH::mesh_array& theMeshesArray, 
322                                               CORBA::Boolean           theUniteIdenticalGroups, 
323                                               CORBA::Boolean           theMergeNodesAndElements, 
324                                               CORBA::Double            theMergeTolerance)
325     throw ( SALOME::SALOME_Exception );
326
327   // ****************************************************
328   // Interface inherited methods (from SALOMEDS::Driver)
329   // ****************************************************
330
331   // Save SMESH data
332   SALOMEDS::TMPFile* Save( SALOMEDS::SComponent_ptr theComponent,
333                          const char*              theURL,
334                          bool                     isMultiFile );
335   // Load SMESH data
336   bool Load( SALOMEDS::SComponent_ptr theComponent,
337              const SALOMEDS::TMPFile& theStream,
338              const char*              theURL,
339              bool                     isMultiFile );
340   // Save SMESH data in ASCII format
341   SALOMEDS::TMPFile* SaveASCII( SALOMEDS::SComponent_ptr theComponent,
342                                 const char*              theURL,
343                                 bool                     isMultiFile );
344   // Load SMESH data in ASCII format
345   bool LoadASCII( SALOMEDS::SComponent_ptr theComponent,
346                   const SALOMEDS::TMPFile& theStream,
347                   const char*              theURL,
348                   bool                     isMultiFile );
349
350   // Create filter manager
351   SMESH::FilterManager_ptr CreateFilterManager();
352
353   // Return a pattern mesher
354   SMESH::SMESH_Pattern_ptr GetPattern();
355
356   // Clears study-connected data when it is closed
357   void Close( SALOMEDS::SComponent_ptr theComponent );
358   
359   // Get component data type
360   char* ComponentDataType();
361     
362   // Transform data from transient form to persistent
363   char* IORToLocalPersistentID( SALOMEDS::SObject_ptr theSObject,
364                                 const char*           IORString,
365                                 CORBA::Boolean        isMultiFile,
366                                 CORBA::Boolean        isASCII );
367   // Transform data from persistent form to transient
368   char* LocalPersistentIDToIOR( SALOMEDS::SObject_ptr theSObject,
369                                 const char*           aLocalPersistentID,
370                                 CORBA::Boolean        isMultiFile,
371                                 CORBA::Boolean        isASCII );
372
373   // Returns true if object can be published in the study
374   bool CanPublishInStudy( CORBA::Object_ptr theIOR );
375   // Publish object in the study
376   SALOMEDS::SObject_ptr PublishInStudy( SALOMEDS::Study_ptr   theStudy,
377                                         SALOMEDS::SObject_ptr theSObject,
378                                         CORBA::Object_ptr     theObject,
379                                         const char*           theName ) 
380     throw ( SALOME::SALOME_Exception );
381
382   // Copy-paste methods - returns true if object can be copied to the clipboard
383   CORBA::Boolean CanCopy( SALOMEDS::SObject_ptr theObject ) { return false; }
384   // Copy-paste methods - copy object to the clipboard
385   SALOMEDS::TMPFile* CopyFrom( SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID ) { return false; }
386   // Copy-paste methods - returns true if object can be pasted from the clipboard
387   CORBA::Boolean CanPaste( const char* theComponentName, CORBA::Long theObjectID ) { return false; }
388   // Copy-paste methods - paste object from the clipboard
389   SALOMEDS::SObject_ptr PasteInto( const SALOMEDS::TMPFile& theStream,
390                                    CORBA::Long              theObjectID,
391                                    SALOMEDS::SObject_ptr    theObject ) {
392     SALOMEDS::SObject_var aResultSO;
393     return aResultSO._retn();
394   }
395
396   // ============
397   // Dump python
398   // ============
399
400   virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, 
401                                        CORBA::Boolean isPublished, 
402                                        CORBA::Boolean& isValidScript);
403
404   void AddToPythonScript (int theStudyID, const TCollection_AsciiString& theString);
405
406   void RemoveLastFromPythonScript (int theStudyID);
407
408   void SavePython (SALOMEDS::Study_ptr theStudy);
409
410   TCollection_AsciiString DumpPython_impl (SALOMEDS::Study_ptr theStudy, 
411                                            Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
412                                            Resource_DataMapOfAsciiStringAsciiString& theNames,
413                                            bool isPublished, 
414                                            bool& aValidScript,
415                                            const TCollection_AsciiString& theSavedTrace);
416
417   TCollection_AsciiString GetNewPythonLines (int theStudyID);
418
419   void CleanPythonTrace (int theStudyID);
420
421
422   // *****************************************
423   // Internal methods
424   // *****************************************
425 public:
426   // Get shape reader
427   GEOM_Client* GetShapeReader();
428
429   // Tags definition 
430   static long GetHypothesisRootTag();
431   static long GetAlgorithmsRootTag();
432   static long GetRefOnShapeTag();
433   static long GetRefOnAppliedHypothesisTag();
434   static long GetRefOnAppliedAlgorithmsTag();
435   static long GetSubMeshOnVertexTag();
436   static long GetSubMeshOnEdgeTag();
437   static long GetSubMeshOnFaceTag();
438   static long GetSubMeshOnSolidTag();
439   static long GetSubMeshOnCompoundTag();
440   static long GetSubMeshOnWireTag();
441   static long GetSubMeshOnShellTag();
442   static long GetNodeGroupsTag();
443   static long GetEdgeGroupsTag();
444   static long GetFaceGroupsTag();
445   static long GetVolumeGroupsTag();
446
447   // publishing methods
448   SALOMEDS::SComponent_ptr PublishComponent(SALOMEDS::Study_ptr theStudy);
449   SALOMEDS::SObject_ptr PublishMesh (SALOMEDS::Study_ptr   theStudy,
450                                      SMESH::SMESH_Mesh_ptr theMesh,
451                                      const char*           theName = 0);
452   SALOMEDS::SObject_ptr PublishHypothesis (SALOMEDS::Study_ptr         theStudy,
453                                            SMESH::SMESH_Hypothesis_ptr theHyp,
454                                            const char*                 theName = 0);
455   SALOMEDS::SObject_ptr PublishSubMesh (SALOMEDS::Study_ptr      theStudy,
456                                         SMESH::SMESH_Mesh_ptr    theMesh,
457                                         SMESH::SMESH_subMesh_ptr theSubMesh,
458                                         GEOM::GEOM_Object_ptr    theShapeObject,
459                                         const char*              theName = 0);
460   SALOMEDS::SObject_ptr PublishGroup (SALOMEDS::Study_ptr    theStudy,
461                                       SMESH::SMESH_Mesh_ptr  theMesh,
462                                       SMESH::SMESH_GroupBase_ptr theGroup,
463                                       GEOM::GEOM_Object_ptr  theShapeObject,
464                                       const char*            theName = 0);
465   bool AddHypothesisToShape(SALOMEDS::Study_ptr         theStudy,
466                             SMESH::SMESH_Mesh_ptr       theMesh,
467                             GEOM::GEOM_Object_ptr       theShapeObject,
468                             SMESH::SMESH_Hypothesis_ptr theHyp);
469   bool RemoveHypothesisFromShape(SALOMEDS::Study_ptr         theStudy,
470                                  SMESH::SMESH_Mesh_ptr       theMesh,
471                                  GEOM::GEOM_Object_ptr       theShapeObject,
472                                  SMESH::SMESH_Hypothesis_ptr theHyp);
473   SALOMEDS::SObject_ptr GetMeshOrSubmeshByShape (SALOMEDS::Study_ptr   theStudy,
474                                                  SMESH::SMESH_Mesh_ptr theMesh,
475                                                  GEOM::GEOM_Object_ptr theShape);
476   static void SetName(SALOMEDS::SObject_ptr theSObject,
477                       const char*           theName,
478                       const char*           theDefaultName = 0);
479
480   static void SetPixMap(SALOMEDS::SObject_ptr theSObject,
481                         const char*           thePixMap);
482
483   // Get study context
484   StudyContext* GetStudyContext( int theStudyId );
485
486   // Get current study context
487   StudyContext* GetCurrentStudyContext();
488
489   // Register an object in a StudyContext; return object id
490   int RegisterObject(CORBA::Object_ptr theObject);
491
492   // Return id of registered object
493   CORBA::Long GetObjectId(CORBA::Object_ptr theObject);
494
495   // Return an object that previously had an oldID
496   template<class TInterface> 
497   typename TInterface::_var_type GetObjectByOldId( const int oldID )
498   {
499     if ( StudyContext* myStudyContext = GetCurrentStudyContext() ) {
500       string ior = myStudyContext->getIORbyOldId( oldID );
501       if ( !ior.empty() )
502         return TInterface::_narrow(GetORB()->string_to_object( ior.c_str() ));
503     }
504     return TInterface::_nil();
505   }
506
507   // Get current study ID
508   int GetCurrentStudyID();
509
510   /*!
511    * \brief Find SObject for an algo
512    */
513   SALOMEDS::SObject_ptr GetAlgoSO(const ::SMESH_Algo* algo);
514
515   SALOMEDS::Study_ptr GetStudy(CORBA::Long theStudyID);
516   SALOME::Notebook_ptr GetNotebook(CORBA::Long theStudyID);
517
518   virtual SALOME::GenericObj_ptr FindObjectByInternalEntry( CORBA::Long theStudyID, const char* theEntry );
519
520 private:
521   // Create hypothesis of given type
522   SMESH::SMESH_Hypothesis_ptr createHypothesis( const char* theHypName,
523                                                 const char* theLibName)
524     throw ( SALOME::SALOME_Exception );
525   
526   // Create empty mesh on shape
527   SMESH::SMESH_Mesh_ptr createMesh()
528     throw ( SALOME::SALOME_Exception );
529
530   static void loadGeomData( SALOMEDS::SComponent_ptr theCompRoot );
531   
532 private:
533   static GEOM::GEOM_Gen_var      myGeomGen;
534   static CORBA::ORB_var          myOrb;         // ORB reference
535   static PortableServer::POA_var myPoa;         // POA reference
536   static SALOME_NamingService*   myNS;          // Naming Service
537   static SALOME_LifeCycleCORBA*  myLCC;         // Life Cycle CORBA
538   static SMESH_Gen_i*            mySMESHGen;    // Point to last created instance of the class
539   ::SMESH_Gen               myGen;              // SMESH_Gen local implementation
540
541   // hypotheses managing
542   map<string, GenericHypothesisCreator_i*> myHypCreatorMap;
543
544   map<int, StudyContext*>   myStudyContextMap;  // Map of study context objects
545
546   GEOM_Client*              myShapeReader;      // Shape reader
547   SALOMEDS::Study_var       myCurrentStudy;     // Current study
548   CORBA::Boolean            myIsEmbeddedMode;   // Current mode
549
550   // Dump Python: trace of API methods calls
551   std::map < int, Handle(TColStd_HSequenceOfAsciiString) > myPythonScripts;
552 };
553
554
555 namespace SMESH
556 {
557   template<class T>
558   T
559   DownCast(CORBA::Object_ptr theArg)
560   {
561     return dynamic_cast<T>(SMESH_Gen_i::GetServant(theArg).in());
562   }
563 }
564
565
566 #endif