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