Salome HOME
Fix on Bug PAL7927
[modules/visu.git] / src / VISU_I / VISU_CorbaMedConvertor.hxx
index 5a86fc7dbb5c39f3cba806d521aff168b1de683b..6b7c94107ae077047bfd960a113b1fcc7ed26f90 100644 (file)
 #include "VISUConfig.hh"
 #include "VISU_Convertor_impl.hxx"
 
-extern "C"{
-#include <med.h>
-}  
+#include <string>      
 
-namespace VISUMED{
-  struct TFamily{
-    SALOME_MED::FAMILY_var myFamily;
-  };
-  typedef std::map<std::string,TFamily> TFamilyMap;
-  
-  struct TField{
-    struct TValForTime{
-      SALOME_MED::FIELD_var myField;
-    };
-    typedef std::map<int,TValForTime> TValField;
-    TValField myValField;
+namespace VISU{
+
+  struct TCMesh: TMeshImpl{
+    SALOME_MED::MESH_var myMesh;
   };
-  typedef map<string,TField> TFieldMap;
+  typedef shared_ptr<TCMesh> PCMesh;
 
-  struct TMeshOnEntity{
+  struct TCMeshOnEntity: TMeshOnEntityImpl{
     SALOME_MED::SUPPORT_var mySupport;
-    typedef pair<int,int> TIndexAndSize;
-    typedef map<int,TIndexAndSize> TCellsFirstIndex;
+    typedef std::pair<int,int> TIndexAndSize;
+    typedef std::map<int,TIndexAndSize> TCellsFirstIndex;
     TCellsFirstIndex myCellsFirstIndex;
-    TFamilyMap myFamilyMap;
-    TFieldMap myFieldMap;
   };
-  typedef std::map<VISU::TEntity,TMeshOnEntity> TMeshOnEntityMap;
+  typedef shared_ptr<TCMeshOnEntity> PCMeshOnEntity;
   
-  struct TGroup{
+  struct TCFamily: TFamilyImpl{
+    SALOME_MED::FAMILY_var myFamily;
+  };
+  typedef shared_ptr<TCFamily> PCFamily;
+  
+  struct TCGroup: TGroupImpl{
     SALOME_MED::GROUP_var myGroup;
   };
-  typedef std::map<std::string,TGroup> TGroupMap;
+  typedef shared_ptr<TCGroup> PCGroup;
 
-  struct TMesh{
-    SALOME_MED::MESH_var myMesh;
-    TMeshOnEntityMap myMeshOnEntityMap;
-    TGroupMap myGroupMap;
+  struct TCField: TFieldImpl{
   };
-  typedef std::map<std::string,TMesh> TMeshMap;
+  typedef shared_ptr<TCField> PCField;
+
+  struct TCValForTime: TValForTimeImpl{
+    SALOME_MED::FIELD_var myField;
+  };
+  typedef shared_ptr<TCValForTime> PCValForTime;
+
 }
 
 
 class VISU_MEDConvertor: public VISU_Convertor_impl{
  protected:
-  VISUMED::TMeshMap myMeshMap2;
   SALOMEDS::SObject_var mySObject;
   VISU_MEDConvertor() {};
+
  public:
   VISU_MEDConvertor(SALOMEDS::SObject_ptr theMedSObject) : mySObject(SALOMEDS::SObject::_duplicate(theMedSObject)) {}
-  virtual VISU_Convertor* Build() ;
+  virtual VISU_Convertor* Build();
+
  protected:
-  virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
-                              const string& theFamilyName = "");
 
-  virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
-                             const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet);
+  VISU_Convertor* Build(SALOME_MED::MED_ptr theMED);
+  VISU_Convertor* Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator);
+
+  virtual int LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                              const std::string& theFamilyName = "");
 
-  virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
-                             VISU::TMeshOnEntity& theMeshOnEntity, 
-                             VISU::TField& theField, 
-                             VISU::TField::TValForTime& theValForTime);
+  virtual int LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
+                             const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet);
 
-  int LoadPoints(VISU::TMesh& theMesh, const string& theFamilyName = "") ;
+  virtual int LoadFieldOnMesh(VISU::PMeshImpl theMesh, 
+                             VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                             VISU::PFieldImpl theField, 
+                             VISU::PValForTimeImpl theValForTime);
 
-  int LoadCellsOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName = "");
+  int LoadPoints(VISU::PCMesh theMesh,
+                const std::string& theFamilyName = "") ;
 
-  int LoadField(const VISU::TMeshOnEntity& theMeshOnEntity,
-               const VISU::TField& theField, VISU::TField::TValForTime& theValForTime);
+  int LoadCellsOnEntity(VISU::PCMesh theMesh,
+                       VISU::PCMeshOnEntity theMeshOnEntity, 
+                       const std::string& theFamilyName = "");
+  
+  int LoadField(VISU::PCMesh theMesh,
+               VISU::PCMeshOnEntity theMeshOnEntity,
+               VISU::PField theField, 
+               VISU::PCValForTime theValForTime);
 
 };
 
@@ -109,7 +115,9 @@ class VISU_MEDFieldConvertor: public VISU_MEDConvertor{
  protected:
   SALOME_MED::FIELD_var myField;
  public:
-  VISU_MEDFieldConvertor(SALOME_MED::FIELD_ptr theField) : myField(SALOME_MED::FIELD::_duplicate(theField)) {}
+  VISU_MEDFieldConvertor(SALOME_MED::FIELD_ptr theField) : 
+    myField(SALOME_MED::FIELD::_duplicate(theField)) 
+  {}
   virtual VISU_Convertor* Build() ;
 };