Salome HOME
Issue 0013373: EDF PAL 273 : Option Single/Multi file dump
[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 //  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 fileter
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   // Copy a part of mesh
239   SMESH::SMESH_Mesh_ptr CopyMesh(SMESH::SMESH_IDSource_ptr meshPart,
240                                  const char*               meshName,
241                                  CORBA::Boolean            toCopyGroups,
242                                  CORBA::Boolean            toKeepIDs);
243
244   // Compute mesh on a shape
245   CORBA::Boolean Compute( SMESH::SMESH_Mesh_ptr theMesh,
246                           GEOM::GEOM_Object_ptr theShapeObject )
247     throw ( SALOME::SALOME_Exception );
248
249   // Cancel Compute mesh on a shape
250   void CancelCompute( SMESH::SMESH_Mesh_ptr theMesh,
251                       GEOM::GEOM_Object_ptr theShapeObject );
252
253   /*!
254    * \brief Return errors of mesh computation
255    */
256   SMESH::compute_error_array* GetComputeErrors(SMESH::SMESH_Mesh_ptr theMesh,
257                                                GEOM::GEOM_Object_ptr  theShapeObject )
258     throw ( SALOME::SALOME_Exception );
259
260   /*!
261    * Evaluate mesh on a shape and
262    *  returns statistic of mesh elements
263    * Result array of number enityties
264    */
265   SMESH::long_array* Evaluate(SMESH::SMESH_Mesh_ptr theMesh,
266                               GEOM::GEOM_Object_ptr theShapeObject)
267     throw ( SALOME::SALOME_Exception );
268
269   // Returns true if mesh contains enough data to be computed
270   CORBA::Boolean IsReadyToCompute( SMESH::SMESH_Mesh_ptr theMesh,
271                                    GEOM::GEOM_Object_ptr theShapeObject )
272     throw ( SALOME::SALOME_Exception );
273
274   /*!
275    * Calculate Mesh as preview till indicated dimension on shape
276    * First, verify list of hypothesis associated with the subShape.
277    * Return mesh preview structure
278    */
279   SMESH::MeshPreviewStruct* Precompute( SMESH::SMESH_Mesh_ptr theMesh,
280                                         GEOM::GEOM_Object_ptr theSubObject,
281                                         SMESH::Dimension      theDimension,
282                                         SMESH::long_array&    theShapesId )
283     throw ( SALOME::SALOME_Exception );
284
285   // Returns errors of hypotheses definintion
286   SMESH::algo_error_array* GetAlgoState( SMESH::SMESH_Mesh_ptr theMesh,
287                                          GEOM::GEOM_Object_ptr theSubObject )
288       throw ( SALOME::SALOME_Exception );
289
290   // Return mesh elements preventing computation of a subshape
291   SMESH::MeshPreviewStruct* GetBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
292                                                  CORBA::Short          theSubShapeID )
293     throw ( SALOME::SALOME_Exception );
294
295   // Get sub-shapes unique ID's list
296   SMESH::long_array* GetSubShapesId( GEOM::GEOM_Object_ptr      theMainShapeObject,
297                                      const SMESH::object_array& theListOfSubShape )
298     throw ( SALOME::SALOME_Exception );
299
300   // Return geometrical object the given element is built on. Publish it in study.
301   GEOM::GEOM_Object_ptr GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr  theMesh,
302                                                   CORBA::Long            theElementID,
303                                                   const char*            theGeomName)
304     throw ( SALOME::SALOME_Exception );
305
306   // Return geometrical object the given element is built on. Don't publish it in study.
307   GEOM::GEOM_Object_ptr FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr  theMesh,
308                                                    CORBA::Long            theElementID)
309     throw ( SALOME::SALOME_Exception );
310
311   // Concatenate the given meshes into one mesh
312   SMESH::SMESH_Mesh_ptr ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
313                                           CORBA::Boolean           theUniteIdenticalGroups,
314                                           CORBA::Boolean           theMergeNodesAndElements,
315                                           CORBA::Double            theMergeTolerance,
316                                           CORBA::Boolean           theCommonGroups)
317     throw ( SALOME::SALOME_Exception );
318
319   // Concatenate the given meshes into one mesh
320   SMESH::SMESH_Mesh_ptr Concatenate(const SMESH::mesh_array& theMeshesArray,
321                                     CORBA::Boolean           theUniteIdenticalGroups,
322                                     CORBA::Boolean           theMergeNodesAndElements,
323                                     CORBA::Double            theMergeTolerance)
324     throw ( SALOME::SALOME_Exception );
325
326   // Concatenate the given meshes into one mesh
327   // Create the groups of all elements from initial meshes
328   SMESH::SMESH_Mesh_ptr ConcatenateWithGroups(const SMESH::mesh_array& theMeshesArray,
329                                               CORBA::Boolean           theUniteIdenticalGroups,
330                                               CORBA::Boolean           theMergeNodesAndElements,
331                                               CORBA::Double            theMergeTolerance)
332     throw ( SALOME::SALOME_Exception );
333
334   // Get MED version of the file by its name
335   CORBA::Boolean GetMEDVersion(const char* theFileName,
336                                SMESH::MED_VERSION& theVersion);
337
338   // Get names of meshes defined in file with the specified name
339   SMESH::string_array* GetMeshNames(const char* theFileName);
340
341   // ****************************************************
342   // Interface inherited methods (from SALOMEDS::Driver)
343   // ****************************************************
344
345   // Save SMESH data
346   SALOMEDS::TMPFile* Save( SALOMEDS::SComponent_ptr theComponent,
347                          const char*              theURL,
348                          bool                     isMultiFile );
349   // Load SMESH data
350   bool Load( SALOMEDS::SComponent_ptr theComponent,
351              const SALOMEDS::TMPFile& theStream,
352              const char*              theURL,
353              bool                     isMultiFile );
354   // Save SMESH data in ASCII format
355   SALOMEDS::TMPFile* SaveASCII( SALOMEDS::SComponent_ptr theComponent,
356                                 const char*              theURL,
357                                 bool                     isMultiFile );
358   // Load SMESH data in ASCII format
359   bool LoadASCII( SALOMEDS::SComponent_ptr theComponent,
360                   const SALOMEDS::TMPFile& theStream,
361                   const char*              theURL,
362                   bool                     isMultiFile );
363
364   // Create filter manager
365   SMESH::FilterManager_ptr CreateFilterManager();
366
367   // Return a pattern mesher
368   SMESH::SMESH_Pattern_ptr GetPattern();
369
370   // Create measurement instance
371   SMESH::Measurements_ptr  CreateMeasurements();
372
373   // Clears study-connected data when it is closed
374   void Close( SALOMEDS::SComponent_ptr theComponent );
375
376   // Get component data type
377   char* ComponentDataType();
378
379   // Transform data from transient form to persistent
380   char* IORToLocalPersistentID( SALOMEDS::SObject_ptr theSObject,
381                                 const char*           IORString,
382                                 CORBA::Boolean        isMultiFile,
383                                 CORBA::Boolean        isASCII );
384   // Transform data from persistent form to transient
385   char* LocalPersistentIDToIOR( SALOMEDS::SObject_ptr theSObject,
386                                 const char*           aLocalPersistentID,
387                                 CORBA::Boolean        isMultiFile,
388                                 CORBA::Boolean        isASCII );
389
390   // Returns true if object can be published in the study
391   bool CanPublishInStudy( CORBA::Object_ptr theIOR );
392   // Publish object in the study
393   SALOMEDS::SObject_ptr PublishInStudy( SALOMEDS::Study_ptr   theStudy,
394                                         SALOMEDS::SObject_ptr theSObject,
395                                         CORBA::Object_ptr     theObject,
396                                         const char*           theName )
397     throw ( SALOME::SALOME_Exception );
398
399   // Copy-paste methods - returns true if object can be copied to the clipboard
400   CORBA::Boolean CanCopy( SALOMEDS::SObject_ptr theObject ) { return false; }
401   // Copy-paste methods - copy object to the clipboard
402   SALOMEDS::TMPFile* CopyFrom( SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID ) { return false; }
403   // Copy-paste methods - returns true if object can be pasted from the clipboard
404   CORBA::Boolean CanPaste( const char* theComponentName, CORBA::Long theObjectID ) { return false; }
405   // Copy-paste methods - paste object from the clipboard
406   SALOMEDS::SObject_ptr PasteInto( const SALOMEDS::TMPFile& theStream,
407                                    CORBA::Long              theObjectID,
408                                    SALOMEDS::SObject_ptr    theObject ) {
409     SALOMEDS::SObject_var aResultSO;
410     return aResultSO._retn();
411   }
412
413   // ============
414   // Dump python
415   // ============
416
417   virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
418                                        CORBA::Boolean isPublished,
419                                        CORBA::Boolean isMultiFile,
420                                        CORBA::Boolean& isValidScript);
421
422   void AddToPythonScript (int theStudyID, const TCollection_AsciiString& theString);
423
424   void RemoveLastFromPythonScript (int theStudyID);
425
426   void SavePython (SALOMEDS::Study_ptr theStudy);
427
428   TCollection_AsciiString DumpPython_impl (SALOMEDS::Study_ptr theStudy,
429                                            Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
430                                            Resource_DataMapOfAsciiStringAsciiString& theNames,
431                                            bool isPublished,
432                                            bool isMultiFile,
433                                            bool& aValidScript,
434                                            const TCollection_AsciiString& theSavedTrace);
435
436   TCollection_AsciiString GetNewPythonLines (int theStudyID);
437
438   void CleanPythonTrace (int theStudyID);
439
440
441   // *****************************************
442   // Internal methods
443   // *****************************************
444 public:
445   // Get shape reader
446   GEOM_Client* GetShapeReader();
447
448   // Tags definition
449   static long GetHypothesisRootTag();
450   static long GetAlgorithmsRootTag();
451   static long GetRefOnShapeTag();
452   static long GetRefOnAppliedHypothesisTag();
453   static long GetRefOnAppliedAlgorithmsTag();
454   static long GetSubMeshOnVertexTag();
455   static long GetSubMeshOnEdgeTag();
456   static long GetSubMeshOnFaceTag();
457   static long GetSubMeshOnSolidTag();
458   static long GetSubMeshOnCompoundTag();
459   static long GetSubMeshOnWireTag();
460   static long GetSubMeshOnShellTag();
461   static long GetNodeGroupsTag();
462   static long GetEdgeGroupsTag();
463   static long GetFaceGroupsTag();
464   static long GetVolumeGroupsTag();
465
466   // publishing methods
467   SALOMEDS::SComponent_ptr PublishComponent(SALOMEDS::Study_ptr theStudy);
468   SALOMEDS::SObject_ptr PublishMesh (SALOMEDS::Study_ptr   theStudy,
469                                      SMESH::SMESH_Mesh_ptr theMesh,
470                                      const char*           theName = 0);
471   SALOMEDS::SObject_ptr PublishHypothesis (SALOMEDS::Study_ptr         theStudy,
472                                            SMESH::SMESH_Hypothesis_ptr theHyp,
473                                            const char*                 theName = 0);
474   SALOMEDS::SObject_ptr PublishSubMesh (SALOMEDS::Study_ptr      theStudy,
475                                         SMESH::SMESH_Mesh_ptr    theMesh,
476                                         SMESH::SMESH_subMesh_ptr theSubMesh,
477                                         GEOM::GEOM_Object_ptr    theShapeObject,
478                                         const char*              theName = 0);
479   SALOMEDS::SObject_ptr PublishGroup (SALOMEDS::Study_ptr    theStudy,
480                                       SMESH::SMESH_Mesh_ptr  theMesh,
481                                       SMESH::SMESH_GroupBase_ptr theGroup,
482                                       GEOM::GEOM_Object_ptr  theShapeObject,
483                                       const char*            theName = 0);
484   bool AddHypothesisToShape(SALOMEDS::Study_ptr         theStudy,
485                             SMESH::SMESH_Mesh_ptr       theMesh,
486                             GEOM::GEOM_Object_ptr       theShapeObject,
487                             SMESH::SMESH_Hypothesis_ptr theHyp);
488   bool RemoveHypothesisFromShape(SALOMEDS::Study_ptr         theStudy,
489                                  SMESH::SMESH_Mesh_ptr       theMesh,
490                                  GEOM::GEOM_Object_ptr       theShapeObject,
491                                  SMESH::SMESH_Hypothesis_ptr theHyp);
492   SALOMEDS::SObject_ptr GetMeshOrSubmeshByShape (SALOMEDS::Study_ptr   theStudy,
493                                                  SMESH::SMESH_Mesh_ptr theMesh,
494                                                  GEOM::GEOM_Object_ptr theShape);
495   static void SetName(SALOMEDS::SObject_ptr theSObject,
496                       const char*           theName,
497                       const char*           theDefaultName = 0);
498
499   static void SetPixMap(SALOMEDS::SObject_ptr theSObject,
500                         const char*           thePixMap);
501
502   //  Get study context
503   StudyContext* GetCurrentStudyContext();
504
505   // Register an object in a StudyContext; return object id
506   int RegisterObject(CORBA::Object_ptr theObject);
507
508   // Return id of registered object
509   CORBA::Long GetObjectId(CORBA::Object_ptr theObject);
510
511   // Return an object that previously had an oldID
512   template<class TInterface>
513   typename TInterface::_var_type GetObjectByOldId( const int oldID )
514   {
515     if ( StudyContext* myStudyContext = GetCurrentStudyContext() ) {
516       string ior = myStudyContext->getIORbyOldId( oldID );
517       if ( !ior.empty() )
518         return TInterface::_narrow(GetORB()->string_to_object( ior.c_str() ));
519     }
520     return TInterface::_nil();
521   }
522
523   // Get current study ID
524   int GetCurrentStudyID();
525
526   /*!
527    * \brief Find SObject for an algo
528    */
529   SALOMEDS::SObject_ptr GetAlgoSO(const ::SMESH_Algo* algo);
530
531   void UpdateParameters(CORBA::Object_ptr theObject, const char* theParameters);
532   char* GetParameters(CORBA::Object_ptr theObject);
533   char* ParseParameters(const char* theParameters);
534
535
536 private:
537   // Create hypothesis of given type
538   SMESH::SMESH_Hypothesis_ptr createHypothesis( const char* theHypName,
539                                                 const char* theLibName)
540     throw ( SALOME::SALOME_Exception );
541
542   // Create empty mesh on shape
543   SMESH::SMESH_Mesh_ptr createMesh()
544     throw ( SALOME::SALOME_Exception );
545
546   static void loadGeomData( SALOMEDS::SComponent_ptr theCompRoot );
547
548 private:
549   static GEOM::GEOM_Gen_var      myGeomGen;
550   static CORBA::ORB_var          myOrb;         // ORB reference
551   static PortableServer::POA_var myPoa;         // POA reference
552   static SALOME_NamingService*   myNS;          // Naming Service
553   static SALOME_LifeCycleCORBA*  myLCC;         // Life Cycle CORBA
554   static SMESH_Gen_i*            mySMESHGen;    // Point to last created instance of the class
555   ::SMESH_Gen               myGen;              // SMESH_Gen local implementation
556
557   // hypotheses managing
558   map<string, GenericHypothesisCreator_i*> myHypCreatorMap;
559
560   map<int, StudyContext*>   myStudyContextMap;  // Map of study context objects
561
562   GEOM_Client*              myShapeReader;      // Shape reader
563   SALOMEDS::Study_var       myCurrentStudy;     // Current study
564   CORBA::Boolean            myIsEmbeddedMode;   // Current mode
565
566   // Dump Python: trace of API methods calls
567   std::map < int, Handle(TColStd_HSequenceOfAsciiString) > myPythonScripts;
568 };
569
570
571 namespace SMESH
572 {
573   template<class T>
574   T
575   DownCast(CORBA::Object_ptr theArg)
576   {
577     return dynamic_cast<T>(SMESH_Gen_i::GetServant(theArg).in());
578   }
579 }
580
581
582 #endif