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