00001 // Copyright (C) 2007-2011 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 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses 00024 // File : SMESH_Hypothesis_i.hxx 00025 // Author : Paul RASCLE, EDF 00026 // Module : SMESH 00027 // $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH_I/SMESH_Hypothesis_i.hxx,v 1.12.20.2.6.1 2011-06-02 05:57:30 vsr Exp $ 00028 // 00029 #ifndef _SMESH_HYPOTHESIS_I_HXX_ 00030 #define _SMESH_HYPOTHESIS_I_HXX_ 00031 00032 #include "SMESH.hxx" 00033 00034 #include <SALOMEconfig.h> 00035 #include CORBA_SERVER_HEADER(SMESH_Hypothesis) 00036 00037 #include "SMESH_Hypothesis.hxx" 00038 #include "SALOME_GenericObj_i.hh" 00039 00040 #include "SMESH_Gen.hxx" 00041 00042 // ====================================================== 00043 // Generic hypothesis 00044 // ====================================================== 00045 class SMESH_I_EXPORT SMESH_Hypothesis_i: 00046 public virtual POA_SMESH::SMESH_Hypothesis, 00047 public virtual SALOME::GenericObj_i 00048 { 00049 public: 00050 // Constructor : placed in protected section to prohibit creation of generic class instance 00051 SMESH_Hypothesis_i( PortableServer::POA_ptr thePOA ); 00052 00053 public: 00054 // Destructor 00055 virtual ~SMESH_Hypothesis_i(); 00056 00057 // Get type name of hypothesis 00058 char* GetName(); 00059 00060 // Get plugin library name of hypothesis 00061 char* GetLibName(); 00062 00063 // Set plugin library name of hypothesis 00064 void SetLibName( const char* theLibName ); 00065 00066 // Get unique id of hypothesis 00067 CORBA::Long GetId(); 00068 00069 // Set list of parameters separated by ":" symbol, used for Hypothesis creation 00070 void SetParameters (const char* theParameters); 00071 00072 // Return list of notebook variables used for Hypothesis creation separated by ":" symbol 00073 char* GetParameters(); 00074 00075 //Return list of last notebook variables used for Hypothesis creation. 00076 SMESH::ListOfParameters* GetLastParameters(); 00077 00078 //Set last parameters for not published hypothesis 00079 00080 void SetLastParameters(const char* theParameters); 00081 00082 // Clear parameters list 00083 void ClearParameters(); 00084 00085 //Return true if hypothesis was published in study 00086 bool IsPublished(); 00087 00088 // Get implementation 00089 ::SMESH_Hypothesis* GetImpl(); 00090 00091 // Persistence 00092 virtual char* SaveTo(); 00093 virtual void LoadFrom( const char* theStream ); 00094 virtual void UpdateAsMeshesRestored(); // for hyps needing full data restored 00095 00096 protected: 00097 ::SMESH_Hypothesis* myBaseImpl; // base hypothesis implementation 00098 }; 00099 00100 // ====================================================== 00101 // Generic hypothesis creator 00102 // ====================================================== 00103 class SMESH_I_EXPORT GenericHypothesisCreator_i 00104 { 00105 public: 00106 // Create a hypothesis 00107 virtual SMESH_Hypothesis_i* Create(PortableServer::POA_ptr thePOA, 00108 int theStudyId, 00109 ::SMESH_Gen* theGenImpl) = 0; 00110 // return the name of IDL module 00111 virtual std::string GetModuleName() = 0; 00112 }; 00113 00114 //============================================================================= 00115 // 00116 // Specific Hypothesis Creators are generated with a template which inherits a 00117 // generic hypothesis creator. Each creator returns an hypothesis of the type 00118 // given in the template. 00119 // 00120 //============================================================================= 00121 template <class T> class HypothesisCreator_i: public GenericHypothesisCreator_i 00122 { 00123 public: 00124 virtual SMESH_Hypothesis_i* Create (PortableServer::POA_ptr thePOA, 00125 int theStudyId, 00126 ::SMESH_Gen* theGenImpl) 00127 { 00128 return new T (thePOA, theStudyId, theGenImpl); 00129 }; 00130 }; 00131 00132 #endif