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* NomComp )
188 ASSERT( myHomardHypothesis );
189 myHomardHypothesis->AddComp( NomComp );
191 //=============================================================================
192 void HOMARD_Hypothesis_i::SupprComp( const char* NomComp )
194 ASSERT( myHomardHypothesis );
195 myHomardHypothesis->SupprComp(NomComp);
197 //=============================================================================
198 void HOMARD_Hypothesis_i::SupprComps()
200 ASSERT( myHomardHypothesis );
201 myHomardHypothesis->SupprComps();
203 //=============================================================================
204 HOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetComps()
206 ASSERT( myHomardHypothesis );
207 const std::list<std::string>& ListString = myHomardHypothesis->GetComps();
208 HOMARD::listeComposantsHypo_var aResult = new HOMARD::listeComposantsHypo;
209 aResult->length( ListString.size() );
210 std::list<std::string>::const_iterator it;
212 for ( it = ListString.begin(); it != ListString.end(); it++ )
214 aResult[i++] = CORBA::string_dup( (*it).c_str() );
216 return aResult._retn();
218 //=============================================================================
219 void HOMARD_Hypothesis_i::SetRefinThr( CORBA::Long TypeThR, CORBA::Double ThreshR )
221 myHomardHypothesis->SetRefinThr( TypeThR, ThreshR );
223 //=============================================================================
224 CORBA::Long HOMARD_Hypothesis_i::GetRefinThrType()
226 ASSERT( myHomardHypothesis );
227 return CORBA::Long( myHomardHypothesis->GetRefinThrType() );
229 //=============================================================================
230 void HOMARD_Hypothesis_i::SetUnRefThr( CORBA::Long TypeThC, CORBA::Double ThreshC )
232 myHomardHypothesis->SetUnRefThr( TypeThC, ThreshC );
234 //=============================================================================
235 CORBA::Long HOMARD_Hypothesis_i::GetUnRefThrType()
237 ASSERT( myHomardHypothesis );
238 return CORBA::Long( myHomardHypothesis->GetUnRefThrType() );
240 //=============================================================================
241 void HOMARD_Hypothesis_i::SetNivMax( CORBA::Long NivMax )
243 ASSERT( myHomardHypothesis );
244 myHomardHypothesis->SetNivMax( NivMax );
246 //=============================================================================
247 CORBA::Long HOMARD_Hypothesis_i::GetNivMax()
249 ASSERT( myHomardHypothesis );
250 return myHomardHypothesis->GetNivMax();
252 //=============================================================================
253 void HOMARD_Hypothesis_i::SetDiamMin( CORBA::Double DiamMin )
255 ASSERT( myHomardHypothesis );
256 myHomardHypothesis->SetDiamMin( DiamMin );
258 //=============================================================================
259 CORBA::Double HOMARD_Hypothesis_i::GetDiamMin()
261 ASSERT( myHomardHypothesis );
262 return myHomardHypothesis->GetDiamMin();
264 //=============================================================================
265 void HOMARD_Hypothesis_i::SetAdapInit( CORBA::Long AdapInit )
267 ASSERT( myHomardHypothesis );
268 myHomardHypothesis->SetAdapInit( AdapInit );
270 //=============================================================================
271 CORBA::Long HOMARD_Hypothesis_i::GetAdapInit()
273 ASSERT( myHomardHypothesis );
274 return myHomardHypothesis->GetAdapInit();
276 //=============================================================================
277 void HOMARD_Hypothesis_i::SetLevelOutput( CORBA::Long LevelOutput )
279 ASSERT( myHomardHypothesis );
280 myHomardHypothesis->SetLevelOutput( LevelOutput );
282 //=============================================================================
283 CORBA::Long HOMARD_Hypothesis_i::GetLevelOutput()
285 ASSERT( myHomardHypothesis );
286 return myHomardHypothesis->GetLevelOutput();
288 //=============================================================================
289 void HOMARD_Hypothesis_i::AddGroup( const char* Group)
291 ASSERT( myHomardHypothesis );
292 myHomardHypothesis->AddGroup( Group );
294 //=============================================================================
295 void HOMARD_Hypothesis_i::SetGroups(const HOMARD::ListGroupType& ListGroup)
297 ASSERT( myHomardHypothesis );
298 std::list<std::string> ListString;
299 for ( int i = 0; i < ListGroup.length(); i++ )
301 ListString.push_back(std::string(ListGroup[i]));
303 myHomardHypothesis->SetGroups( ListString );
305 //=============================================================================
306 HOMARD::ListGroupType* HOMARD_Hypothesis_i::GetGroups()
308 ASSERT( myHomardHypothesis );
309 const std::list<std::string>& ListString = myHomardHypothesis->GetGroups();
310 HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType;
311 aResult->length( ListString.size() );
312 std::list<std::string>::const_iterator it;
314 for ( it = ListString.begin(); it != ListString.end(); it++ )
316 aResult[i++] = CORBA::string_dup( (*it).c_str() );
318 return aResult._retn();
320 //=============================================================================
321 void HOMARD_Hypothesis_i::SetTypeFieldInterp( CORBA::Long TypeFieldInterp )
323 ASSERT( myHomardHypothesis );
324 myHomardHypothesis->SetTypeFieldInterp( TypeFieldInterp );
326 //=============================================================================
327 CORBA::Long HOMARD_Hypothesis_i::GetTypeFieldInterp()
329 ASSERT( myHomardHypothesis );
330 return CORBA::Long( myHomardHypothesis->GetTypeFieldInterp() );
332 //=============================================================================
333 void HOMARD_Hypothesis_i::AddFieldInterp( const char* FieldInterp )
335 ASSERT( myHomardHypothesis );
336 myHomardHypothesis->AddFieldInterpType( FieldInterp, 0 );
338 //=============================================================================
339 void HOMARD_Hypothesis_i::AddFieldInterpType( const char* FieldInterp, CORBA::Long TypeInterp )
341 ASSERT( myHomardHypothesis );
342 myHomardHypothesis->AddFieldInterpType( FieldInterp, TypeInterp );
344 //=============================================================================
345 void HOMARD_Hypothesis_i::SupprFieldInterp( const char* FieldInterp )
347 ASSERT( myHomardHypothesis );
348 myHomardHypothesis->SupprFieldInterp(FieldInterp);
350 //=============================================================================
351 void HOMARD_Hypothesis_i::SupprFieldInterps()
353 ASSERT( myHomardHypothesis );
354 myHomardHypothesis->SupprFieldInterps();
356 //=============================================================================
357 HOMARD::listeFieldInterpsHypo* HOMARD_Hypothesis_i::GetFieldInterps()
359 ASSERT( myHomardHypothesis );
360 const std::list<std::string>& ListString = myHomardHypothesis->GetFieldInterps();
361 HOMARD::listeFieldInterpsHypo_var aResult = new HOMARD::listeFieldInterpsHypo;
362 aResult->length( ListString.size() );
363 std::list<std::string>::const_iterator it;
365 for ( it = ListString.begin(); it != ListString.end(); it++ )
367 aResult[i++] = CORBA::string_dup( (*it).c_str() );
369 return aResult._retn();
371 //=============================================================================
372 //=============================================================================
373 // Liens avec les autres structures
374 //=============================================================================
375 //=============================================================================
376 void HOMARD_Hypothesis_i::SetCaseCreation( const char* NomCaseCreation )
378 ASSERT( myHomardHypothesis );
379 myHomardHypothesis->SetCaseCreation( NomCaseCreation );
381 //=============================================================================
382 char* HOMARD_Hypothesis_i::GetCaseCreation()
384 ASSERT( myHomardHypothesis );
385 return CORBA::string_dup( myHomardHypothesis->GetCaseCreation().c_str() );
387 //=============================================================================
388 void HOMARD_Hypothesis_i::LinkIteration( const char* NomIteration )
390 ASSERT( myHomardHypothesis );
391 myHomardHypothesis->LinkIteration( NomIteration );
393 //=============================================================================
394 void HOMARD_Hypothesis_i::UnLinkIteration( const char* NomIteration )
396 ASSERT( myHomardHypothesis );
397 myHomardHypothesis->UnLinkIteration( NomIteration );
399 //=============================================================================
400 HOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations()
402 ASSERT( myHomardHypothesis );
403 const std::list<std::string>& ListString = myHomardHypothesis->GetIterations();
404 HOMARD::listeIters_var aResult = new HOMARD::listeIters;
405 aResult->length( ListString.size() );
406 std::list<std::string>::const_iterator it;
408 for ( it = ListString.begin(); it != ListString.end(); it++ )
410 aResult[i++] = CORBA::string_dup( (*it).c_str() );
412 return aResult._retn();
414 //=============================================================================
415 void HOMARD_Hypothesis_i::AddZone( const char* NomZone, CORBA::Long TypeUse )
417 MESSAGE ("Dans AddZone pour " << NomZone) ;
418 ASSERT( myHomardHypothesis );
419 char* NomHypo = GetName() ;
420 return _gen_i->AssociateHypoZone(NomHypo, NomZone, TypeUse) ;
422 //=============================================================================
423 void HOMARD_Hypothesis_i::AddZone0( const char* NomZone, CORBA::Long TypeUse )
425 MESSAGE ("Dans AddZone0 pour " << NomZone) ;
426 ASSERT( myHomardHypothesis );
427 myHomardHypothesis->AddZone( NomZone, TypeUse );
429 //=============================================================================
430 void HOMARD_Hypothesis_i::SupprZone(const char * NomZone)
432 ASSERT( myHomardHypothesis );
433 myHomardHypothesis->SupprZone( NomZone);
435 //=============================================================================
436 void HOMARD_Hypothesis_i::SupprZones()
438 ASSERT( myHomardHypothesis );
439 myHomardHypothesis->SupprZones();
441 //=============================================================================
442 HOMARD::listeZonesHypo* HOMARD_Hypothesis_i::GetZones()
444 ASSERT( myHomardHypothesis );
445 const std::list<std::string>& ListString = myHomardHypothesis->GetZones();
446 HOMARD::listeZonesHypo_var aResult = new HOMARD::listeZonesHypo;
447 aResult->length( ListString.size() );
448 std::list<std::string>::const_iterator it;
450 for ( it = ListString.begin(); it != ListString.end(); it++ )
452 aResult[i++] = CORBA::string_dup( (*it).c_str() );
454 return aResult._retn();