1 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
24 // File : SMESH_Hypothesis_i.hxx
25 // Author : Paul RASCLE, EDF
28 #ifndef _SMESH_HYPOTHESIS_I_HXX_
29 #define _SMESH_HYPOTHESIS_I_HXX_
33 #include <SALOMEconfig.h>
34 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
36 #include "SMESH_Hypothesis.hxx"
37 #include "SALOME_GenericObj_i.hh"
39 #include "SMESH_Gen.hxx"
44 class TCollection_AsciiString;
46 // ======================================================
48 // ======================================================
49 class SMESH_I_EXPORT SMESH_Hypothesis_i:
50 public virtual POA_SMESH::SMESH_Hypothesis,
51 public virtual SALOME::GenericObj_i
54 // Constructor : placed in protected section to prohibit creation of generic class instance
55 SMESH_Hypothesis_i( PortableServer::POA_ptr thePOA );
59 virtual ~SMESH_Hypothesis_i();
61 // Get type name of hypothesis
64 // Get plugin library name of hypothesis
67 // Set plugin library name of hypothesis
68 void SetLibName( const char* theLibName );
70 // Get unique id of hypothesis
73 // Set the variable parameter; method is a name of method setting this parameter.
74 // This method must be called by the hypothesis creator just before calling hyp->method()
75 void SetVarParameter (const char* parameter, const char* method);
77 // Return the variable parameter used for Hypothesis creation by name of method
78 // setting this parameter
79 char* GetVarParameter (const char* methodName);
81 // Set list of parameters separated by ":" symbol, used for Hypothesis creation
82 void SetParameters (const char* theParameters);
84 // Return list of notebook variables used for Hypothesis creation separated by ":" symbol
85 char* GetParameters();
87 //Return list of last notebook variables used for Hypothesis creation.
88 SMESH::ListOfParameters* GetLastParameters();
90 //Set last parameters for not published hypothesis
92 void SetLastParameters(const char* theParameters);
94 // Clear parameters list
95 void ClearParameters();
97 //Return true if hypothesis was published in study
100 // Get implementation
101 ::SMESH_Hypothesis* GetImpl();
104 virtual char* SaveTo();
105 virtual void LoadFrom( const char* theStream );
106 virtual void UpdateAsMeshesRestored(); // for hyps needing full data restored
109 ::SMESH_Hypothesis* myBaseImpl; // base hypothesis implementation
111 std::map< std::string, std::string > myMethod2VarParams; // variable parameters
115 // Methods for backward compatibility of notebook variables
117 // restore myMethod2VarParams by parameters stored in an old study
118 virtual void setOldParameters (const char* theParameters);
120 // method used to convert variable parameters stored in an old study
121 // into myMethod2VarParams. It should return a method name for an index of
122 // variable parameters. Index is countered from zero
123 virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const { return ""; }
125 // method intended to remove explicit treatment of Netgen hypotheses from SMESH_NoteBook
126 virtual int getParamIndex(const TCollection_AsciiString& method, int nbVars) const { return -1; }
129 // ======================================================
130 // Generic hypothesis creator
131 // ======================================================
132 class SMESH_I_EXPORT GenericHypothesisCreator_i
135 // Create a hypothesis
136 virtual SMESH_Hypothesis_i* Create(PortableServer::POA_ptr thePOA,
138 ::SMESH_Gen* theGenImpl) = 0;
139 // return the name of IDL module
140 virtual std::string GetModuleName() = 0;
143 //=============================================================================
145 // Specific Hypothesis Creators are generated with a template which inherits a
146 // generic hypothesis creator. Each creator returns an hypothesis of the type
147 // given in the template.
149 //=============================================================================
150 template <class T> class HypothesisCreator_i: public GenericHypothesisCreator_i
153 virtual SMESH_Hypothesis_i* Create (PortableServer::POA_ptr thePOA,
155 ::SMESH_Gen* theGenImpl)
157 return new T (thePOA, theStudyId, theGenImpl);