Back to index

salome-med  6.5.0
Med_Gen_i.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  MED MED : implemetation of MED idl descriptions
00024 //  File   : Med_Gen_i.hxx
00025 //  Author : Paul RASCLE, EDF
00026 //  Module : MED
00027 
00028 #ifndef _MED_GEN_I_HXX_
00029 #define _MED_GEN_I_HXX_
00030 
00031 #include <SALOMEconfig.h>
00032 #include <map>
00033 #include CORBA_SERVER_HEADER(MED_Gen)
00034 #include CORBA_SERVER_HEADER(MED)
00035 #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
00036 
00037 #include "SALOME_Component_i.hxx"
00038 #include "SALOME_NamingService.hxx"
00039 
00040 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
00041 
00042 #include "Med_Gen_Driver_i.hxx"
00043 
00044 namespace MEDMEM {
00045   class MED_i;
00046 }
00047 
00048 #ifdef WNT
00049  #if defined MED_EXPORTS || defined MEDEngine_EXPORTS
00050   #if defined WIN32
00051    #define MED_EXPORT __declspec( dllexport )
00052   #else
00053    #define MED_EXPORT
00054   #endif
00055  #else
00056   #if defined WIN32
00057    #define MED_EXPORT __declspec( dllimport )
00058   #else
00059    #define MED_EXPORT
00060   #endif
00061  #endif
00062 #else
00063  #define MED_EXPORT
00064 #endif
00065 
00066 class MED_EXPORT Med_Gen_i:
00067   public POA_SALOME_MED::MED_Gen,
00068   public Engines_Component_i,
00069   public Med_Gen_Driver_i
00070 {
00071 private:
00072   SALOMEDS::Study_var studyName2Study(const char* studyName)
00073     throw(SALOME::SALOME_Exception);
00074   void addInStudy(SALOMEDS::Study_var myStudy)
00075     throw(SALOME::SALOME_Exception);
00076 
00077 public:
00078   //Med_Gen_i();
00079   Med_Gen_i(CORBA::ORB_ptr orb,
00080             PortableServer::POA_ptr poa,
00081             PortableServer::ObjectId * contId,
00082             const char *instanceName,
00083             const char *interfaceName);
00084   virtual ~Med_Gen_i();
00085 
00086   //
00087   SALOME_MED::GMESH_ptr readMeshInFile(const char* fileName,
00088                                       const char* studyName,
00089                                       const char* meshName)
00090     throw(SALOME::SALOME_Exception);
00091 
00092   SALOME_MED::FIELD_ptr readFieldInFile(const char* fileName,
00093                                         const char* studyName,
00094                                         const char* fieldName,
00095                                         CORBA::Long iter,
00096                                         CORBA::Long ordre)
00097     throw(SALOME::SALOME_Exception);
00098 
00099   SALOME_MED::MED_ptr   readStructFile(const char* fileName,
00100                                        const char* studyName)
00101     throw(SALOME::SALOME_Exception);
00102 
00103   void    readStructFileWithFieldType(const char* fileName,
00104                                       const char* studyName)
00105     throw(SALOME::SALOME_Exception);
00106 
00107   // Get last created instance of the class
00108   static Med_Gen_i* GetMEDGen() { return _MEDGen; }
00109 
00110   // Get Med of the study (for persistance)
00111   static SALOME_MED::MED_ptr GetMED(SALOMEDS::SComponent_ptr theStudy);
00112 
00113   // Get object of the CORBA reference
00114   static PortableServer::ServantBase_var GetServant( CORBA::Object_ptr theObject );
00115 
00116   template<class T>
00117   static T DownCast(CORBA::Object_ptr theArg)
00118   {
00119     return dynamic_cast<T>(GetServant(theArg).in());
00120   }
00121 
00122   // (re)defined methods of Driver
00123   char* ComponentDataType();
00124   virtual Engines::EngineComponent_ptr GetComponentInstance();
00125 
00126 private:
00127   //static std::string _myFileName;
00128   //static std::string _saveFileName;
00129   static Med_Gen_i*  _MEDGen;    // Point to last created instance of the class
00130 
00131 private:
00132   bool   _duringLoad;
00133   //int    _myStudyID;
00134   //std::string _myStudyName;
00135 
00136   //int myCounter;
00137 };
00138 
00139 #endif