1 // Copyright (C) 2011-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // L'ordre de description des fonctions est le meme dans tous les fichiers
21 // HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
22 // 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
23 // 2. Les caracteristiques
24 // 3. Le lien avec les autres structures
26 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
29 #include "HOMARD_Hypothesis_i.hxx"
30 #include "HOMARD_Gen_i.hxx"
31 #include "HOMARD_Hypothesis.hxx"
32 #include "HOMARD_DriverTools.hxx"
34 #include "utilities.h"
36 //=============================================================================
38 * standard constructor
40 //=============================================================================
41 HOMARD_Hypothesis_i::HOMARD_Hypothesis_i()
43 MESSAGE( "Default constructor, not for use" );
47 //=============================================================================
49 * standard constructor
51 //=============================================================================
52 HOMARD_Hypothesis_i::HOMARD_Hypothesis_i( CORBA::ORB_ptr orb,
53 HOMARD::HOMARD_Gen_var engine )
55 MESSAGE( "standard constructor" );
58 myHomardHypothesis = new ::HOMARD_Hypothesis();
59 ASSERT( myHomardHypothesis );
62 //=============================================================================
66 //=============================================================================
67 HOMARD_Hypothesis_i::~HOMARD_Hypothesis_i()
70 //=============================================================================
71 //=============================================================================
73 //=============================================================================
74 //=============================================================================
75 void HOMARD_Hypothesis_i::SetName( const char* Name )
77 ASSERT( myHomardHypothesis );
78 myHomardHypothesis->SetName( Name );
80 //=============================================================================
81 char* HOMARD_Hypothesis_i::GetName()
83 ASSERT( myHomardHypothesis );
84 return CORBA::string_dup( myHomardHypothesis->GetName().c_str() );
86 //=============================================================================
87 CORBA::Long HOMARD_Hypothesis_i::Delete()
89 ASSERT( myHomardHypothesis );
90 char* HypoName = GetName() ;
91 MESSAGE ( "Delete : destruction de l'hypothese " << HypoName );
92 return _gen_i->DeleteHypo(HypoName) ;
94 //=============================================================================
95 char* HOMARD_Hypothesis_i::GetDumpPython()
97 ASSERT( myHomardHypothesis );
98 return CORBA::string_dup( myHomardHypothesis->GetDumpPython().c_str() );
100 //=============================================================================
101 std::string HOMARD_Hypothesis_i::Dump() const
103 return HOMARD::Dump( *myHomardHypothesis );
105 //=============================================================================
106 bool HOMARD_Hypothesis_i::Restore( const std::string& stream )
108 return HOMARD::Restore( *myHomardHypothesis, stream );
110 //=============================================================================
111 //=============================================================================
113 //=============================================================================
114 //=============================================================================
115 void HOMARD_Hypothesis_i::SetAdapRefinUnRef( CORBA::Long TypeAdap,CORBA::Long TypeRaff, CORBA::Long TypeDera )
117 ASSERT( myHomardHypothesis );
118 myHomardHypothesis->SetAdapType( TypeAdap );
119 myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera );
121 //=============================================================================
122 HOMARD::listeTypes* HOMARD_Hypothesis_i::GetAdapRefinUnRef()
124 ASSERT( myHomardHypothesis );
125 HOMARD::listeTypes_var aResult = new HOMARD::listeTypes;
126 aResult->length( 3 );
127 aResult[0] = CORBA::Long( myHomardHypothesis->GetAdapType() );
128 aResult[1] = CORBA::Long( myHomardHypothesis->GetRefinType() );
129 aResult[2] = CORBA::Long( myHomardHypothesis->GetUnRefType() );
130 return aResult._retn();
132 //=============================================================================
133 CORBA::Long HOMARD_Hypothesis_i::GetAdapType()
135 ASSERT( myHomardHypothesis );
136 return CORBA::Long( myHomardHypothesis->GetAdapType() );
138 //=============================================================================
139 CORBA::Long HOMARD_Hypothesis_i::GetRefinType()
141 ASSERT( myHomardHypothesis );
142 return CORBA::Long( myHomardHypothesis->GetRefinType() );
144 //=============================================================================
145 CORBA::Long HOMARD_Hypothesis_i::GetUnRefType()
147 ASSERT( myHomardHypothesis );
148 return CORBA::Long( myHomardHypothesis->GetUnRefType() );
150 //=============================================================================
151 void HOMARD_Hypothesis_i::SetField( const char* FieldName )
153 myHomardHypothesis->SetField( FieldName );
155 //=============================================================================
156 char* HOMARD_Hypothesis_i::GetFieldName()
158 ASSERT( myHomardHypothesis );
159 return CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() );
161 //=============================================================================
162 void HOMARD_Hypothesis_i::SetUseField( CORBA::Long UsField )
164 myHomardHypothesis->SetUseField( UsField );
166 //=============================================================================
167 HOMARD::InfosHypo* HOMARD_Hypothesis_i::GetField()
169 ASSERT(myHomardHypothesis);
170 HOMARD::InfosHypo* aInfosHypo = new HOMARD::InfosHypo();
171 aInfosHypo->FieldName = CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() );
172 aInfosHypo->TypeThR = CORBA::Long( myHomardHypothesis->GetRefinThrType() );
173 aInfosHypo->ThreshR = CORBA::Double( myHomardHypothesis->GetThreshR() );
174 aInfosHypo->TypeThC = CORBA::Long( myHomardHypothesis->GetUnRefThrType() );
175 aInfosHypo->ThreshC = CORBA::Double( myHomardHypothesis->GetThreshC() );
176 aInfosHypo->UsField = CORBA::Long( myHomardHypothesis->GetUseField() );
177 aInfosHypo->UsCmpI = CORBA::Long( myHomardHypothesis->GetUseComp() );
180 //=============================================================================
181 void HOMARD_Hypothesis_i::SetUseComp( CORBA::Long UsCmpI )
183 myHomardHypothesis->SetUseComp( UsCmpI );
185 //=============================================================================
186 void HOMARD_Hypothesis_i::AddComp( const char* NomComposant )
188 ASSERT( myHomardHypothesis );
189 myHomardHypothesis->AddComp( NomComposant );
191 //=============================================================================
192 void HOMARD_Hypothesis_i::SupprComp()
194 ASSERT( myHomardHypothesis );
195 myHomardHypothesis->SupprComp();
197 //=============================================================================
198 HOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetListComp()
200 ASSERT( myHomardHypothesis );
201 const std::list<std::string>& ListString = myHomardHypothesis->GetListComp();
202 HOMARD::listeComposantsHypo_var aResult = new HOMARD::listeComposantsHypo;
203 aResult->length( ListString.size() );
204 std::list<std::string>::const_iterator it;
206 for ( it = ListString.begin(); it != ListString.end(); it++ )
208 aResult[i++] = CORBA::string_dup( (*it).c_str() );
210 return aResult._retn();
212 //=============================================================================
213 void HOMARD_Hypothesis_i::SetRefinThr( CORBA::Long TypeThR, CORBA::Double ThreshR )
215 myHomardHypothesis->SetRefinThr( TypeThR, ThreshR );
217 //=============================================================================
218 CORBA::Long HOMARD_Hypothesis_i::GetRefinThrType()
220 ASSERT( myHomardHypothesis );
221 return CORBA::Long( myHomardHypothesis->GetRefinThrType() );
223 //=============================================================================
224 void HOMARD_Hypothesis_i::SetUnRefThr( CORBA::Long TypeThC, CORBA::Double ThreshC )
226 myHomardHypothesis->SetUnRefThr( TypeThC, ThreshC );
228 //=============================================================================
229 CORBA::Long HOMARD_Hypothesis_i::GetUnRefThrType()
231 ASSERT( myHomardHypothesis );
232 return CORBA::Long( myHomardHypothesis->GetUnRefThrType() );
234 //=============================================================================
235 void HOMARD_Hypothesis_i::SetNivMax( CORBA::Long NivMax )
237 ASSERT( myHomardHypothesis );
238 myHomardHypothesis->SetNivMax( NivMax );
240 //=============================================================================
241 CORBA::Long HOMARD_Hypothesis_i::GetNivMax()
243 ASSERT( myHomardHypothesis );
244 return myHomardHypothesis->GetNivMax();
246 //=============================================================================
247 void HOMARD_Hypothesis_i::SetDiamMin( CORBA::Double DiamMin )
249 ASSERT( myHomardHypothesis );
250 myHomardHypothesis->SetDiamMin( DiamMin );
252 //=============================================================================
253 CORBA::Double HOMARD_Hypothesis_i::GetDiamMin()
255 ASSERT( myHomardHypothesis );
256 return myHomardHypothesis->GetDiamMin();
258 //=============================================================================
259 void HOMARD_Hypothesis_i::SetAdapInit( CORBA::Long AdapInit )
261 ASSERT( myHomardHypothesis );
262 myHomardHypothesis->SetAdapInit( AdapInit );
264 //=============================================================================
265 CORBA::Long HOMARD_Hypothesis_i::GetAdapInit()
267 ASSERT( myHomardHypothesis );
268 return myHomardHypothesis->GetAdapInit();
270 //=============================================================================
271 void HOMARD_Hypothesis_i::SetLevelOutput( CORBA::Long LevelOutput )
273 ASSERT( myHomardHypothesis );
274 myHomardHypothesis->SetLevelOutput( LevelOutput );
276 //=============================================================================
277 CORBA::Long HOMARD_Hypothesis_i::GetLevelOutput()
279 ASSERT( myHomardHypothesis );
280 return myHomardHypothesis->GetLevelOutput();
282 //=============================================================================
283 void HOMARD_Hypothesis_i::AddGroup( const char* Group)
285 ASSERT( myHomardHypothesis );
286 myHomardHypothesis->AddGroup( Group );
288 //=============================================================================
289 void HOMARD_Hypothesis_i::SetGroups(const HOMARD::ListGroupType& ListGroup)
291 ASSERT( myHomardHypothesis );
292 std::list<std::string> ListString;
293 for ( int i = 0; i < ListGroup.length(); i++ )
295 ListString.push_back(std::string(ListGroup[i]));
297 myHomardHypothesis->SetGroups( ListString );
299 //=============================================================================
300 HOMARD::ListGroupType* HOMARD_Hypothesis_i::GetGroups()
302 ASSERT( myHomardHypothesis );
303 const std::list<std::string>& ListString = myHomardHypothesis->GetGroups();
304 HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType;
305 aResult->length( ListString.size() );
306 std::list<std::string>::const_iterator it;
308 for ( it = ListString.begin(); it != ListString.end(); it++ )
310 aResult[i++] = CORBA::string_dup( (*it).c_str() );
312 return aResult._retn();
314 //=============================================================================
315 void HOMARD_Hypothesis_i::SetTypeFieldInterp( CORBA::Long TypeFieldInterp )
317 ASSERT( myHomardHypothesis );
318 myHomardHypothesis->SetTypeFieldInterp( TypeFieldInterp );
320 //=============================================================================
321 CORBA::Long HOMARD_Hypothesis_i::GetTypeFieldInterp()
323 ASSERT( myHomardHypothesis );
324 return CORBA::Long( myHomardHypothesis->GetTypeFieldInterp() );
326 //=============================================================================
327 void HOMARD_Hypothesis_i::AddFieldInterp( const char* FieldInterp )
329 ASSERT( myHomardHypothesis );
330 myHomardHypothesis->AddFieldInterp( FieldInterp );
332 //=============================================================================
333 void HOMARD_Hypothesis_i::SupprFieldInterp()
335 ASSERT( myHomardHypothesis );
336 myHomardHypothesis->SupprFieldInterp();
338 //=============================================================================
339 HOMARD::listFieldInterpHypo* HOMARD_Hypothesis_i::GetListFieldInterp()
341 ASSERT( myHomardHypothesis );
342 const std::list<std::string>& ListString = myHomardHypothesis->GetListFieldInterp();
343 HOMARD::listFieldInterpHypo_var aResult = new HOMARD::listFieldInterpHypo;
344 aResult->length( ListString.size() );
345 std::list<std::string>::const_iterator it;
347 for ( it = ListString.begin(); it != ListString.end(); it++ )
349 aResult[i++] = CORBA::string_dup( (*it).c_str() );
351 return aResult._retn();
353 //=============================================================================
354 //=============================================================================
355 // Liens avec les autres structures
356 //=============================================================================
357 //=============================================================================
358 void HOMARD_Hypothesis_i::SetCaseCreation( const char* NomCaseCreation )
360 ASSERT( myHomardHypothesis );
361 myHomardHypothesis->SetCaseCreation( NomCaseCreation );
363 //=============================================================================
364 char* HOMARD_Hypothesis_i::GetCaseCreation()
366 ASSERT( myHomardHypothesis );
367 return CORBA::string_dup( myHomardHypothesis->GetCaseCreation().c_str() );
369 //=============================================================================
370 void HOMARD_Hypothesis_i::LinkIteration( const char* NomIteration )
372 ASSERT(myHomardHypothesis);
373 myHomardHypothesis->LinkIteration( NomIteration );
375 //=============================================================================
376 void HOMARD_Hypothesis_i::UnLinkIteration( const char* NomIteration )
378 ASSERT(myHomardHypothesis);
379 myHomardHypothesis->UnLinkIteration( NomIteration );
381 //=============================================================================
382 HOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations()
384 ASSERT(myHomardHypothesis);
385 const std::list<std::string>& ListString = myHomardHypothesis->GetIterations();
386 HOMARD::listeIters_var aResult = new HOMARD::listeIters;
387 aResult->length( ListString.size() );
388 std::list<std::string>::const_iterator it;
390 for ( it = ListString.begin(); it != ListString.end(); it++ )
392 aResult[i++] = CORBA::string_dup( (*it).c_str() );
394 return aResult._retn();
396 //=============================================================================
397 void HOMARD_Hypothesis_i::AddZone( const char* NomZone, CORBA::Long TypeUse )
399 MESSAGE ("Dans AddZone pour " << NomZone) ;
400 ASSERT( myHomardHypothesis );
401 char* NomHypo = GetName() ;
402 return _gen_i->AssociateHypoZone(NomHypo, NomZone, TypeUse) ;
404 //=============================================================================
405 void HOMARD_Hypothesis_i::AddZone0( const char* NomZone, CORBA::Long TypeUse )
407 MESSAGE ("Dans AddZone0 pour " << NomZone) ;
408 ASSERT( myHomardHypothesis );
409 myHomardHypothesis->AddZone( NomZone, TypeUse );
411 //=============================================================================
412 void HOMARD_Hypothesis_i::SupprZone(const char * NomZone)
414 ASSERT(myHomardHypothesis);
415 myHomardHypothesis->SupprZone( NomZone);
417 //=============================================================================
418 HOMARD::listeZonesHypo* HOMARD_Hypothesis_i::GetZones()
420 ASSERT(myHomardHypothesis);
421 const std::list<std::string>& ListString = myHomardHypothesis->GetZones();
422 HOMARD::listeZonesHypo_var aResult = new HOMARD::listeZonesHypo;
423 aResult->length( ListString.size() );
424 std::list<std::string>::const_iterator it;
426 for ( it = ListString.begin(); it != ListString.end(); it++ )
428 aResult[i++] = CORBA::string_dup( (*it).c_str() );
430 return aResult._retn();