1 // Copyright (C) 2011-2014 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, or (at your option) any later version.
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
21 // L'ordre de description des fonctions est le meme dans tous les fichiers
22 // HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
23 // 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
24 // 2. Les caracteristiques
25 // 3. Le lien avec les autres structures
27 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
30 #include "HOMARD_Hypothesis_i.hxx"
31 #include "HOMARD_Gen_i.hxx"
32 #include "HOMARD_Hypothesis.hxx"
33 #include "HOMARD_DriverTools.hxx"
35 #include "utilities.h"
37 //=============================================================================
39 * standard constructor
41 //=============================================================================
42 HOMARD_Hypothesis_i::HOMARD_Hypothesis_i()
44 MESSAGE( "Default constructor, not for use" );
48 //=============================================================================
50 * standard constructor
52 //=============================================================================
53 HOMARD_Hypothesis_i::HOMARD_Hypothesis_i( CORBA::ORB_ptr orb,
54 HOMARD::HOMARD_Gen_var engine )
56 MESSAGE( "standard constructor" );
59 myHomardHypothesis = new ::HOMARD_Hypothesis();
60 ASSERT( myHomardHypothesis );
63 //=============================================================================
67 //=============================================================================
68 HOMARD_Hypothesis_i::~HOMARD_Hypothesis_i()
71 //=============================================================================
72 //=============================================================================
74 //=============================================================================
75 //=============================================================================
76 void HOMARD_Hypothesis_i::SetName( const char* Name )
78 ASSERT( myHomardHypothesis );
79 myHomardHypothesis->SetName( Name );
81 //=============================================================================
82 char* HOMARD_Hypothesis_i::GetName()
84 ASSERT( myHomardHypothesis );
85 return CORBA::string_dup( myHomardHypothesis->GetName().c_str() );
87 //=============================================================================
88 CORBA::Long HOMARD_Hypothesis_i::Delete()
90 ASSERT( myHomardHypothesis );
91 char* HypoName = GetName() ;
92 MESSAGE ( "Delete : destruction de l'hypothese " << HypoName );
93 return _gen_i->DeleteHypo(HypoName) ;
95 //=============================================================================
96 char* HOMARD_Hypothesis_i::GetDumpPython()
98 ASSERT( myHomardHypothesis );
99 return CORBA::string_dup( myHomardHypothesis->GetDumpPython().c_str() );
101 //=============================================================================
102 std::string HOMARD_Hypothesis_i::Dump() const
104 return HOMARD::Dump( *myHomardHypothesis );
106 //=============================================================================
107 bool HOMARD_Hypothesis_i::Restore( const std::string& stream )
109 return HOMARD::Restore( *myHomardHypothesis, stream );
111 //=============================================================================
112 //=============================================================================
114 //=============================================================================
115 //=============================================================================
116 void HOMARD_Hypothesis_i::SetAdapRefinUnRef( CORBA::Long TypeAdap,CORBA::Long TypeRaff, CORBA::Long TypeDera )
118 ASSERT( myHomardHypothesis );
119 myHomardHypothesis->SetAdapType( TypeAdap );
120 myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera );
122 //=============================================================================
123 HOMARD::listeTypes* HOMARD_Hypothesis_i::GetAdapRefinUnRef()
125 ASSERT( myHomardHypothesis );
126 HOMARD::listeTypes_var aResult = new HOMARD::listeTypes;
127 aResult->length( 3 );
128 aResult[0] = CORBA::Long( myHomardHypothesis->GetAdapType() );
129 aResult[1] = CORBA::Long( myHomardHypothesis->GetRefinType() );
130 aResult[2] = CORBA::Long( myHomardHypothesis->GetUnRefType() );
131 return aResult._retn();
133 //=============================================================================
134 CORBA::Long HOMARD_Hypothesis_i::GetAdapType()
136 ASSERT( myHomardHypothesis );
137 return CORBA::Long( myHomardHypothesis->GetAdapType() );
139 //=============================================================================
140 CORBA::Long HOMARD_Hypothesis_i::GetRefinType()
142 ASSERT( myHomardHypothesis );
143 return CORBA::Long( myHomardHypothesis->GetRefinType() );
145 //=============================================================================
146 CORBA::Long HOMARD_Hypothesis_i::GetUnRefType()
148 ASSERT( myHomardHypothesis );
149 return CORBA::Long( myHomardHypothesis->GetUnRefType() );
151 //=============================================================================
152 void HOMARD_Hypothesis_i::SetField( const char* FieldName )
154 myHomardHypothesis->SetField( FieldName );
156 //=============================================================================
157 char* HOMARD_Hypothesis_i::GetFieldName()
159 ASSERT( myHomardHypothesis );
160 return CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() );
162 //=============================================================================
163 void HOMARD_Hypothesis_i::SetUseField( CORBA::Long UsField )
165 myHomardHypothesis->SetUseField( UsField );
167 //=============================================================================
168 HOMARD::InfosHypo* HOMARD_Hypothesis_i::GetField()
170 ASSERT( myHomardHypothesis );
171 HOMARD::InfosHypo* aInfosHypo = new HOMARD::InfosHypo();
172 aInfosHypo->FieldName = CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() );
173 aInfosHypo->TypeThR = CORBA::Long( myHomardHypothesis->GetRefinThrType() );
174 aInfosHypo->ThreshR = CORBA::Double( myHomardHypothesis->GetThreshR() );
175 aInfosHypo->TypeThC = CORBA::Long( myHomardHypothesis->GetUnRefThrType() );
176 aInfosHypo->ThreshC = CORBA::Double( myHomardHypothesis->GetThreshC() );
177 aInfosHypo->UsField = CORBA::Long( myHomardHypothesis->GetUseField() );
178 aInfosHypo->UsCmpI = CORBA::Long( myHomardHypothesis->GetUseComp() );
181 //=============================================================================
182 void HOMARD_Hypothesis_i::SetUseComp( CORBA::Long UsCmpI )
184 myHomardHypothesis->SetUseComp( UsCmpI );
186 //=============================================================================
187 void HOMARD_Hypothesis_i::AddComp( const char* NomComp )
189 ASSERT( myHomardHypothesis );
190 myHomardHypothesis->AddComp( NomComp );
192 //=============================================================================
193 void HOMARD_Hypothesis_i::SupprComp( const char* NomComp )
195 ASSERT( myHomardHypothesis );
196 myHomardHypothesis->SupprComp(NomComp);
198 //=============================================================================
199 void HOMARD_Hypothesis_i::SupprComps()
201 ASSERT( myHomardHypothesis );
202 myHomardHypothesis->SupprComps();
204 //=============================================================================
205 HOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetComps()
207 ASSERT( myHomardHypothesis );
208 const std::list<std::string>& ListString = myHomardHypothesis->GetComps();
209 HOMARD::listeComposantsHypo_var aResult = new HOMARD::listeComposantsHypo;
210 aResult->length( ListString.size() );
211 std::list<std::string>::const_iterator it;
213 for ( it = ListString.begin(); it != ListString.end(); it++ )
215 aResult[i++] = CORBA::string_dup( (*it).c_str() );
217 return aResult._retn();
219 //=============================================================================
220 void HOMARD_Hypothesis_i::SetRefinThr( CORBA::Long TypeThR, CORBA::Double ThreshR )
222 myHomardHypothesis->SetRefinThr( TypeThR, ThreshR );
224 //=============================================================================
225 CORBA::Long HOMARD_Hypothesis_i::GetRefinThrType()
227 ASSERT( myHomardHypothesis );
228 return CORBA::Long( myHomardHypothesis->GetRefinThrType() );
230 //=============================================================================
231 void HOMARD_Hypothesis_i::SetUnRefThr( CORBA::Long TypeThC, CORBA::Double ThreshC )
233 myHomardHypothesis->SetUnRefThr( TypeThC, ThreshC );
235 //=============================================================================
236 CORBA::Long HOMARD_Hypothesis_i::GetUnRefThrType()
238 ASSERT( myHomardHypothesis );
239 return CORBA::Long( myHomardHypothesis->GetUnRefThrType() );
241 //=============================================================================
242 void HOMARD_Hypothesis_i::SetNivMax( CORBA::Long NivMax )
244 ASSERT( myHomardHypothesis );
245 myHomardHypothesis->SetNivMax( NivMax );
247 //=============================================================================
248 CORBA::Long HOMARD_Hypothesis_i::GetNivMax()
250 ASSERT( myHomardHypothesis );
251 return myHomardHypothesis->GetNivMax();
253 //=============================================================================
254 void HOMARD_Hypothesis_i::SetDiamMin( CORBA::Double DiamMin )
256 ASSERT( myHomardHypothesis );
257 myHomardHypothesis->SetDiamMin( DiamMin );
259 //=============================================================================
260 CORBA::Double HOMARD_Hypothesis_i::GetDiamMin()
262 ASSERT( myHomardHypothesis );
263 return myHomardHypothesis->GetDiamMin();
265 //=============================================================================
266 void HOMARD_Hypothesis_i::SetAdapInit( CORBA::Long AdapInit )
268 ASSERT( myHomardHypothesis );
269 myHomardHypothesis->SetAdapInit( AdapInit );
271 //=============================================================================
272 CORBA::Long HOMARD_Hypothesis_i::GetAdapInit()
274 ASSERT( myHomardHypothesis );
275 return myHomardHypothesis->GetAdapInit();
277 //=============================================================================
278 void HOMARD_Hypothesis_i::SetLevelOutput( CORBA::Long LevelOutput )
280 ASSERT( myHomardHypothesis );
281 myHomardHypothesis->SetLevelOutput( LevelOutput );
283 //=============================================================================
284 CORBA::Long HOMARD_Hypothesis_i::GetLevelOutput()
286 ASSERT( myHomardHypothesis );
287 return myHomardHypothesis->GetLevelOutput();
289 //=============================================================================
290 void HOMARD_Hypothesis_i::AddGroup( const char* Group)
292 ASSERT( myHomardHypothesis );
293 myHomardHypothesis->AddGroup( Group );
295 //=============================================================================
296 void HOMARD_Hypothesis_i::SetGroups(const HOMARD::ListGroupType& ListGroup)
298 ASSERT( myHomardHypothesis );
299 std::list<std::string> ListString;
300 for ( int i = 0; i < ListGroup.length(); i++ )
302 ListString.push_back(std::string(ListGroup[i]));
304 myHomardHypothesis->SetGroups( ListString );
306 //=============================================================================
307 HOMARD::ListGroupType* HOMARD_Hypothesis_i::GetGroups()
309 ASSERT( myHomardHypothesis );
310 const std::list<std::string>& ListString = myHomardHypothesis->GetGroups();
311 HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType;
312 aResult->length( ListString.size() );
313 std::list<std::string>::const_iterator it;
315 for ( it = ListString.begin(); it != ListString.end(); it++ )
317 aResult[i++] = CORBA::string_dup( (*it).c_str() );
319 return aResult._retn();
321 //=============================================================================
322 void HOMARD_Hypothesis_i::SetTypeFieldInterp( CORBA::Long TypeFieldInterp )
324 ASSERT( myHomardHypothesis );
325 myHomardHypothesis->SetTypeFieldInterp( TypeFieldInterp );
327 //=============================================================================
328 CORBA::Long HOMARD_Hypothesis_i::GetTypeFieldInterp()
330 ASSERT( myHomardHypothesis );
331 return CORBA::Long( myHomardHypothesis->GetTypeFieldInterp() );
333 //=============================================================================
334 void HOMARD_Hypothesis_i::AddFieldInterp( const char* FieldInterp )
336 ASSERT( myHomardHypothesis );
337 myHomardHypothesis->AddFieldInterpType( FieldInterp, 0 );
339 //=============================================================================
340 void HOMARD_Hypothesis_i::AddFieldInterpType( const char* FieldInterp, CORBA::Long TypeInterp )
342 ASSERT( myHomardHypothesis );
343 myHomardHypothesis->AddFieldInterpType( FieldInterp, TypeInterp );
345 //=============================================================================
346 void HOMARD_Hypothesis_i::SupprFieldInterp( const char* FieldInterp )
348 ASSERT( myHomardHypothesis );
349 myHomardHypothesis->SupprFieldInterp(FieldInterp);
351 //=============================================================================
352 void HOMARD_Hypothesis_i::SupprFieldInterps()
354 ASSERT( myHomardHypothesis );
355 myHomardHypothesis->SupprFieldInterps();
357 //=============================================================================
358 HOMARD::listeFieldInterpsHypo* HOMARD_Hypothesis_i::GetFieldInterps()
360 ASSERT( myHomardHypothesis );
361 const std::list<std::string>& ListString = myHomardHypothesis->GetFieldInterps();
362 HOMARD::listeFieldInterpsHypo_var aResult = new HOMARD::listeFieldInterpsHypo;
363 aResult->length( ListString.size() );
364 std::list<std::string>::const_iterator it;
366 for ( it = ListString.begin(); it != ListString.end(); it++ )
368 aResult[i++] = CORBA::string_dup( (*it).c_str() );
370 return aResult._retn();
372 //=============================================================================
373 //=============================================================================
374 // Liens avec les autres structures
375 //=============================================================================
376 //=============================================================================
377 void HOMARD_Hypothesis_i::SetCaseCreation( const char* NomCaseCreation )
379 ASSERT( myHomardHypothesis );
380 myHomardHypothesis->SetCaseCreation( NomCaseCreation );
382 //=============================================================================
383 char* HOMARD_Hypothesis_i::GetCaseCreation()
385 ASSERT( myHomardHypothesis );
386 return CORBA::string_dup( myHomardHypothesis->GetCaseCreation().c_str() );
388 //=============================================================================
389 void HOMARD_Hypothesis_i::LinkIteration( const char* NomIteration )
391 ASSERT( myHomardHypothesis );
392 myHomardHypothesis->LinkIteration( NomIteration );
394 //=============================================================================
395 void HOMARD_Hypothesis_i::UnLinkIteration( const char* NomIteration )
397 ASSERT( myHomardHypothesis );
398 myHomardHypothesis->UnLinkIteration( NomIteration );
400 //=============================================================================
401 HOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations()
403 ASSERT( myHomardHypothesis );
404 const std::list<std::string>& ListString = myHomardHypothesis->GetIterations();
405 HOMARD::listeIters_var aResult = new HOMARD::listeIters;
406 aResult->length( ListString.size() );
407 std::list<std::string>::const_iterator it;
409 for ( it = ListString.begin(); it != ListString.end(); it++ )
411 aResult[i++] = CORBA::string_dup( (*it).c_str() );
413 return aResult._retn();
415 //=============================================================================
416 void HOMARD_Hypothesis_i::AddZone( const char* NomZone, CORBA::Long TypeUse )
418 MESSAGE ("Dans AddZone pour " << NomZone) ;
419 ASSERT( myHomardHypothesis );
420 char* NomHypo = GetName() ;
421 return _gen_i->AssociateHypoZone(NomHypo, NomZone, TypeUse) ;
423 //=============================================================================
424 void HOMARD_Hypothesis_i::AddZone0( const char* NomZone, CORBA::Long TypeUse )
426 MESSAGE ("Dans AddZone0 pour " << NomZone) ;
427 ASSERT( myHomardHypothesis );
428 myHomardHypothesis->AddZone( NomZone, TypeUse );
430 //=============================================================================
431 void HOMARD_Hypothesis_i::SupprZone(const char * NomZone)
433 ASSERT( myHomardHypothesis );
434 myHomardHypothesis->SupprZone( NomZone);
436 //=============================================================================
437 void HOMARD_Hypothesis_i::SupprZones()
439 ASSERT( myHomardHypothesis );
440 myHomardHypothesis->SupprZones();
442 //=============================================================================
443 HOMARD::listeZonesHypo* HOMARD_Hypothesis_i::GetZones()
445 ASSERT( myHomardHypothesis );
446 const std::list<std::string>& ListString = myHomardHypothesis->GetZones();
447 HOMARD::listeZonesHypo_var aResult = new HOMARD::listeZonesHypo;
448 aResult->length( ListString.size() );
449 std::list<std::string>::const_iterator it;
451 for ( it = ListString.begin(); it != ListString.end(); it++ )
453 aResult[i++] = CORBA::string_dup( (*it).c_str() );
455 return aResult._retn();