1 // HOMARD HOMARD : implementation of HOMARD idl descriptions
3 // Copyright (C) 2011-2013 CEA/DEN, EDF R&D
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License.
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // Pilote l'ecriture du fichier xml pour lancer un schema YACS
30 #include "YACSDriver.hxx"
32 #include "Utils_SALOME_Exception.hxx"
33 #include "utilities.h"
35 //=============================================================================
36 //=============================================================================
37 YACSDriver::YACSDriver(const std::string XMLFile, const std::string DirName):
38 _XMLFile( "" ), _DirName( "" ),
40 _Texte_parametres( "" ),
41 _noeud_1( "CreateHypothesis" ),
44 MESSAGE("XMLFile = "<<XMLFile<<", DirName ="<<DirName);
48 //=============================================================================
49 //=============================================================================
50 YACSDriver::~YACSDriver()
53 //===============================================================================
54 // Ajout d'une ligne simple
55 //===============================================================================
56 void YACSDriver::TexteAdd( const std::string ligne )
58 // MESSAGE("TexteAdd, ligne ="<<ligne);
60 _Texte += ligne + "\n" ;
63 //===============================================================================
64 // Nom du fichier du maillage initial
65 //===============================================================================
66 void YACSDriver::Texte_DataInit_MeshFile( const std::string Meshfile )
68 MESSAGE("TexteInitMeshfile, Meshfile ="<<Meshfile);
70 _Texte += " <value><string>" ;
72 _Texte += "</string></value>\n" ;
75 //===============================================================================
76 // Le repertoire de calcul
77 // Le script de lancement
78 //===============================================================================
79 void YACSDriver::Texte_Alternance_Calcul_HOMARD_Calcul( const std::string FileName )
81 MESSAGE("Texte_Alternance_Calcul_HOMARD_Calcul, FileName : "<<FileName);
83 int position = FileName.find_last_of( '/' ) ;
84 std::string nomfic = FileName.substr( position+1 ) ;
85 position = nomfic.find_last_of( '.' ) ;;
86 nomfic = nomfic.substr( 0, position ) ;
87 MESSAGE("nomfic : "<<nomfic) ;
89 _Texte += "rep_calc = \"" + _DirName + "\"\n" ;
90 _Texte += "rep_script = os.path.dirname(\"" + FileName + "\")\n" ;
91 _Texte += "sys.path.append(rep_script)\n" ;
92 _Texte += "from " + nomfic + " import Script\n" ;
95 //===============================================================================
97 //===============================================================================
98 void YACSDriver::Texte_Iter_1_Case_Options( const std::string pythonTexte )
100 MESSAGE("Texte_Iter_1_Case_Options, pythonTexte\n"<<pythonTexte);
102 _Texte += "DirName = \"" + _DirName + "/HOMARD\"\n" ;
103 _Texte += "Case.SetDirName(DirName)\n" ;
105 Texte_python_1( pythonTexte, 1, "Case" ) ;
108 //===============================================================================
109 // La description des zones
110 // ZoneType : le type de la zone
111 // pythonStructure : le python correspondant a la zone
112 // methode : methode associee a la creation de la zone
113 // ZoneName : nom de la zone
114 //===============================================================================
115 std::string YACSDriver::Texte_Iter_1_Zone( int ZoneType, const std::string pythonStructure, const std::string methode, const std::string ZoneName )
117 MESSAGE("Texte_Iter_1_Zone, ZoneType = "<<ZoneType<<", pythonStructure = "<<pythonStructure);
118 MESSAGE("methode = "<<methode<<", ZoneName = "<<ZoneName );
120 // 1. Le nom du noeud
121 std::string noeud_2 = methode + "_" + ZoneName ;
122 std::string node = "Boucle_de_convergence.Alternance_Calcul_HOMARD.Adaptation.p0_Adaptation_HOMARD.HOMARD_Initialisation.p1_Iter_1." ;
124 // 2. Texte de controle
125 std::string texte_control = Texte_control (_noeud_1, noeud_2) ;
127 // 3. Definition du service
128 _Texte += " <service name=\"" + noeud_2 + "\">\n" ;
129 _Texte += " <node>Etude_Initialisation.SetCurrentStudy</node>\n" ;
130 _Texte += " <method>" + methode + "</method>\n" ;
132 // 4.1. Le nom de la zone
133 _Texte += Texte_inport( "string", "ZoneName" ) ;
134 TexteParametre( node, "ZoneName", "string", ZoneName ) ;
135 // 4.2. Les valeurs numeriques
136 // ATTENTION : les noms doivent etre les memes que dans Gen.xml, donc HOMARD_Gen.idl
137 // 4.2.1. Decodage des valeurs
138 // La chaine pythonStructure est de ce genre :
139 // CreateZoneBox( "Zone_1", 0.144, 0.216, 0.096, 0.1464, 0.076, 0.12)
140 std::string ligne = pythonStructure ;
141 // On commence par ne garder que ce qui suit la premiere virgule
142 ligne = GetStringInTexte( ligne, ",", 1 );
143 // On boucle pour isoler toutes les chaines dans les virgules
144 std::string lignebis ;
145 std::string x0, x1, x2, x3, x4, x5, x6, x7, x8 ;
147 while ( ligne != lignebis )
149 lignebis = GetStringInTexte ( ligne, ",", 0 ) ;
150 // MESSAGE("lignebis = "<<lignebis );
151 if ( iaux == 0 ) { x0 = lignebis ; }
152 else if ( iaux == 1 ) { x1 = lignebis ; }
153 else if ( iaux == 2 ) { x2 = lignebis ; }
154 else if ( iaux == 3 ) { x3 = lignebis ; }
155 else if ( iaux == 4 ) { x4 = lignebis ; }
156 else if ( iaux == 5 ) { x5 = lignebis ; }
157 else if ( iaux == 6 ) { x6 = lignebis ; }
158 else if ( iaux == 7 ) { x7 = lignebis ; }
159 ligne = GetStringInTexte( ligne, ",", 1 );
162 // La derniere valeur est toujours mise dans x8
163 x8 = GetStringInTexte ( ligne, ")", 0 ) ;
164 MESSAGE("coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6<<","<<x7<<","<<x8);
165 // 4.2. Cas du parallelepipede (2)
168 _Texte += Texte_inport( "double", "Xmini" ) ;
169 _Texte += Texte_inport( "double", "Xmaxi" ) ;
170 _Texte += Texte_inport( "double", "Ymini" ) ;
171 _Texte += Texte_inport( "double", "Ymaxi" ) ;
172 _Texte += Texte_inport( "double", "Zmini" ) ;
173 _Texte += Texte_inport( "double", "Zmaxi" ) ;
174 TexteParametre( node, "Xmini", "double", x0 ) ;
175 TexteParametre( node, "Xmaxi", "double", x1 ) ;
176 TexteParametre( node, "Ymini", "double", x2 ) ;
177 TexteParametre( node, "Ymaxi", "double", x3 ) ;
178 TexteParametre( node, "Zmini", "double", x4 ) ;
179 TexteParametre( node, "Zmaxi", "double", x8 ) ;
182 // 4.2. Cas du rectangle (11, 12, 13)
183 else if ( ( ZoneType > 10 ) && ( ZoneType < 14 ) )
185 _Texte += Texte_inport( "double", "Umini" ) ;
186 _Texte += Texte_inport( "double", "Umaxi" ) ;
187 _Texte += Texte_inport( "double", "Vmini" ) ;
188 _Texte += Texte_inport( "double", "Vmaxi" ) ;
189 _Texte += Texte_inport( "long", "Orient" ) ;
190 TexteParametre( node, "Umini", "double", x0 ) ;
191 TexteParametre( node, "Umaxi", "double", x1 ) ;
192 TexteParametre( node, "Vmini", "double", x2 ) ;
193 TexteParametre( node, "Vmaxi", "double", x3 ) ;
194 TexteParametre( node, "Orient", "int", x8 ) ;
197 // 4.2. Cas du disque (31, 32, 33) ou du disque perce (61, 62, 63)
198 else if ( ( ( ZoneType > 30 ) && ( ZoneType < 34 ) ) || ( ( ZoneType > 60 ) && ( ZoneType < 64 ) ) )
200 _Texte += Texte_inport( "double", "Ucentre" ) ;
201 _Texte += Texte_inport( "double", "Vcentre" ) ;
202 _Texte += Texte_inport( "double", "Radius" ) ;
203 TexteParametre( node, "Ucentre", "double", x0 ) ;
204 TexteParametre( node, "Vcentre", "double", x1 ) ;
205 TexteParametre( node, "Radius", "double", x2 ) ;
208 _Texte += Texte_inport( "double", "InternalRadius" ) ;
209 TexteParametre( node, "InternalRadius", "double", x3 ) ;
211 _Texte += Texte_inport( "long", "Orient" ) ;
212 TexteParametre( node, "Orient", "int", x8 ) ;
215 // 4.2. Cas de la sphere (4)
216 else if ( ZoneType == 4 )
218 _Texte += Texte_inport( "double", "Xcentre" ) ;
219 _Texte += Texte_inport( "double", "Ycentre" ) ;
220 _Texte += Texte_inport( "double", "Zcentre" ) ;
221 _Texte += Texte_inport( "double", "Radius" ) ;
222 TexteParametre( node, "Xcentre", "double", x0 ) ;
223 TexteParametre( node, "Ycentre", "double", x1 ) ;
224 TexteParametre( node, "Zcentre", "double", x2 ) ;
225 TexteParametre( node, "Radius", "double", x8 ) ;
228 // 4.2. Cas du cylindre (5) ou du tuyau (7)
229 else if ( ZoneType == 5 || ZoneType == 7 )
231 _Texte += Texte_inport( "double", "Xcentre" ) ;
232 _Texte += Texte_inport( "double", "Ycentre" ) ;
233 _Texte += Texte_inport( "double", "Zcentre" ) ;
234 _Texte += Texte_inport( "double", "Xaxis" ) ;
235 _Texte += Texte_inport( "double", "Yaxis" ) ;
236 _Texte += Texte_inport( "double", "Zaxis" ) ;
237 _Texte += Texte_inport( "double", "Radius" ) ;
238 _Texte += Texte_inport( "double", "Height" ) ;
239 TexteParametre( node, "Xcentre", "double", x0 ) ;
240 TexteParametre( node, "Ycentre", "double", x1 ) ;
241 TexteParametre( node, "Zcentre", "double", x2 ) ;
242 TexteParametre( node, "Xaxis", "double", x3 ) ;
243 TexteParametre( node, "Yaxis", "double", x4 ) ;
244 TexteParametre( node, "Zaxis", "double", x5 ) ;
245 TexteParametre( node, "Radius", "double", x6 ) ;
248 TexteParametre( node, "Height", "double", x8 ) ;
252 _Texte += Texte_inport( "double", "InternalRadius" ) ;
253 TexteParametre( node, "Height", "double", x7 ) ;
254 TexteParametre( node, "InternalRadius", "double", x8 ) ;
260 { VERIFICATION("Type de zone inconnu." == 0); }
264 _Texte += " <outport name=\"return\" type=\"HOMARD_Zone\"/>\n" ;
265 _Texte += " </service>\n" ;
267 return texte_control ;
270 //===============================================================================
271 // La description des frontieres
272 // BoundaryType : le type de la frontiere
273 // pythonStructure : le python correspondant a la frontiere
274 // methode : methode associee a la creation de la frontiere
275 // BoundaryName : nom de la frontiere
276 //===============================================================================
277 std::string YACSDriver::Texte_Iter_1_Boundary( int BoundaryType, const std::string pythonStructure, const std::string methode, const std::string BoundaryName )
279 MESSAGE("Texte_Iter_1_Boundary, BoundaryType = "<<BoundaryType<<", pythonStructure = "<<pythonStructure);
280 MESSAGE("methode = "<<methode<<", BoundaryName = "<<BoundaryName );
282 // 1. Le nom du noeud
283 std::string noeud_2 = methode + "_" + BoundaryName ;
284 std::string node = "Boucle_de_convergence.Alternance_Calcul_HOMARD.Adaptation.p0_Adaptation_HOMARD.HOMARD_Initialisation.p1_Iter_1." ;
286 // 2. Texte de controle
287 std::string texte_control = Texte_control (_noeud_1, noeud_2) ;
289 // 3. Definition du service
290 _Texte += " <service name=\"" + noeud_2 + "\">\n" ;
291 _Texte += " <node>Etude_Initialisation.SetCurrentStudy</node>\n" ;
292 _Texte += " <method>" + methode + "</method>\n" ;
294 // 4.1. Le nom de la zone
295 _Texte += Texte_inport( "string", "BoundaryName" ) ;
296 TexteParametre( node, "BoundaryName", "string", BoundaryName ) ;
297 // 4.2. Les valeurs numeriques
298 // ATTENTION : les noms doivent etre les memes que dans Gen.xml, donc HOMARD_Gen.idl
299 // 4.2.1. Decodage des valeurs
300 // La chaine pythonStructure est de ce genre :
301 // CreateBoundaryCylinder('cyl_2', 17.5, -2.5, -12.5, -100., -75., -25., 50.)
302 // CreateBoundaryDi("intersection", "PIQUAGE", "/scratch/D68518/Salome/script/sfr_2d_piquage.fr.med")
303 std::string ligne = pythonStructure ;
304 // On commence par ne garder que ce qui suit la premiere virgule
305 ligne = GetStringInTexte( ligne, ",", 1 );
306 // On boucle pour isoler toutes les chaines dans les virgules
307 std::string lignebis ;
308 std::string x0, x1, x2, x3, x4, x5, x6, x7 ;
310 while ( ligne != lignebis )
312 lignebis = GetStringInTexte ( ligne, ",", 0 ) ;
313 // MESSAGE("lignebis = "<<lignebis );
314 if ( iaux == 0 ) { x0 = lignebis ; }
315 else if ( iaux == 1 ) { x1 = lignebis ; }
316 else if ( iaux == 2 ) { x2 = lignebis ; }
317 else if ( iaux == 3 ) { x3 = lignebis ; }
318 else if ( iaux == 4 ) { x4 = lignebis ; }
319 else if ( iaux == 5 ) { x5 = lignebis ; }
320 else if ( iaux == 6 ) { x6 = lignebis ; }
321 ligne = GetStringInTexte( ligne, ",", 1 );
324 // La derniere valeur est toujours mise dans x7
325 x7 = GetStringInTexte ( ligne, ")", 0 ) ;
326 MESSAGE("Valeurs = "<< x0<<", "<<x1<< ", "<< x2<< ", "<< x3<<", "<<x4<<", "<<x5<<", "<<x6<<", x7"<<x7);
328 // 4.2. Cas d une frontiere discrete (0)
329 if (BoundaryType == 0) // Cas d une frontiere discrete
331 _Texte += Texte_inport( "string", "MeshName" ) ;
332 TexteParametre( node, "MeshName", "string", x0 ) ;
333 _Texte += Texte_inport( "string", "FileName" ) ;
334 TexteParametre( node, "FileName", "string", x7 ) ;
336 // 4.2. Cas du cylindre (1)
337 else if ( BoundaryType == 1 )
339 _Texte += Texte_inport( "double", "Xcentre" ) ;
340 _Texte += Texte_inport( "double", "Ycentre" ) ;
341 _Texte += Texte_inport( "double", "Zcentre" ) ;
342 _Texte += Texte_inport( "double", "Xaxis" ) ;
343 _Texte += Texte_inport( "double", "Yaxis" ) ;
344 _Texte += Texte_inport( "double", "Zaxis" ) ;
345 _Texte += Texte_inport( "double", "Radius" ) ;
346 TexteParametre( node, "Xcentre", "double", x0 ) ;
347 TexteParametre( node, "Ycentre", "double", x1 ) ;
348 TexteParametre( node, "Zcentre", "double", x2 ) ;
349 TexteParametre( node, "Xaxis", "double", x3 ) ;
350 TexteParametre( node, "Yaxis", "double", x4 ) ;
351 TexteParametre( node, "Zaxis", "double", x5 ) ;
352 TexteParametre( node, "Radius", "double", x7 ) ;
355 // 4.2. Cas de la sphere (2)
356 else if ( BoundaryType == 2 )
358 _Texte += Texte_inport( "double", "Xcentre" ) ;
359 _Texte += Texte_inport( "double", "Ycentre" ) ;
360 _Texte += Texte_inport( "double", "Zcentre" ) ;
361 _Texte += Texte_inport( "double", "Radius" ) ;
362 TexteParametre( node, "Xcentre", "double", x0 ) ;
363 TexteParametre( node, "Ycentre", "double", x1 ) ;
364 TexteParametre( node, "Zcentre", "double", x2 ) ;
365 TexteParametre( node, "Radius", "double", x7 ) ;
368 // 4.2. Cas d un cone defini par un axe et un angle
369 else if ( BoundaryType == 3 )
371 _Texte += Texte_inport( "double", "Xaxis" ) ;
372 _Texte += Texte_inport( "double", "Yaxis" ) ;
373 _Texte += Texte_inport( "double", "Zaxis" ) ;
374 _Texte += Texte_inport( "double", "Angle" ) ;
375 _Texte += Texte_inport( "double", "Xcentre" ) ;
376 _Texte += Texte_inport( "double", "Ycentre" ) ;
377 _Texte += Texte_inport( "double", "Zcentre" ) ;
378 TexteParametre( node, "Xaxis", "double", x0 ) ;
379 TexteParametre( node, "Yaxis", "double", x1 ) ;
380 TexteParametre( node, "Zaxis", "double", x2 ) ;
381 TexteParametre( node, "Angle", "double", x3 ) ;
382 TexteParametre( node, "Xcentre", "double", x4 ) ;
383 TexteParametre( node, "Ycentre", "double", x5 ) ;
384 TexteParametre( node, "Zcentre", "double", x7 ) ;
387 // 4.2. Cas d un cone defini par les 2 rayons
388 else if ( BoundaryType == 4 )
390 _Texte += Texte_inport( "double", "Xcentre1" ) ;
391 _Texte += Texte_inport( "double", "Ycentre1" ) ;
392 _Texte += Texte_inport( "double", "Zcentre1" ) ;
393 _Texte += Texte_inport( "double", "Radius1" ) ;
394 _Texte += Texte_inport( "double", "Xcentre2" ) ;
395 _Texte += Texte_inport( "double", "Ycentre2" ) ;
396 _Texte += Texte_inport( "double", "Zcentre2" ) ;
397 _Texte += Texte_inport( "double", "Radius2" ) ;
398 TexteParametre( node, "Xcentre1", "double", x0 ) ;
399 TexteParametre( node, "Ycentre1", "double", x1 ) ;
400 TexteParametre( node, "Zcentre1", "double", x2 ) ;
401 TexteParametre( node, "Radius1", "double", x3 ) ;
402 TexteParametre( node, "Xcentre2", "double", x4 ) ;
403 TexteParametre( node, "Ycentre2", "double", x5 ) ;
404 TexteParametre( node, "Zcentre2", "double", x6 ) ;
405 TexteParametre( node, "Radius2", "double", x7 ) ;
410 { VERIFICATION("Type de frontiere inconnu." == 0); }
414 _Texte += " <outport name=\"return\" type=\"HOMARD_Boundary\"/>\n" ;
415 _Texte += " </service>\n" ;
417 return texte_control ;
420 //===============================================================================
421 // Controle des enchainements de noeud dans le noeud Iter_1
422 //===============================================================================
423 std::string YACSDriver::Texte_Iter_1_control()
425 MESSAGE("Texte_Iter_1_control");
428 texte = Texte_control ("CreateCase", "Case_Options") ;
429 texte += Texte_control ("Case_Options", "CreateHypothesis") ;
434 //===============================================================================
435 // Controle des enchainements de noeuds
436 // noeud_1 : noeud de depart
437 // noeud_2 : noeud d'arrivee
438 //===============================================================================
439 std::string YACSDriver::Texte_control( const std::string noeud_1, const std::string noeud_2 )
441 MESSAGE("Texte_control, noeud_1 = "<<noeud_1<<", noeud_2 = "<<noeud_2);
444 texte = " <control> " ;
445 texte += "<fromnode>" + noeud_1 + "</fromnode>" ;
446 texte += " <tonode>" + noeud_2 + "</tonode>" ;
447 texte += " </control>\n" ;
452 //===============================================================================
454 // inport_type : type de la donnee a importer
455 // inport_nom : nom de la donnee a importer
456 //===============================================================================
457 std::string YACSDriver::Texte_inport( const std::string inport_type, const std::string inport_nom )
459 // MESSAGE("Texte_control, inport_type = "<<inport_type<<", inport_nom = "<<inport_nom);
462 texte = " <inport " ;
463 texte += "name=\"" + inport_nom + "\" " ;
464 texte += "type=\"" + inport_type + "\"" ;
470 //===============================================================================
471 // Le repertoire d'execution
472 //===============================================================================
473 void YACSDriver::Texte_HOMARD_Exec_DirName( )
475 MESSAGE("Texte_HOMARD_Exec_DirName");
477 _Texte += "DirName = \"" + _DirName + "\"\n" ;
480 //===============================================================================
481 // Le nom du maillage
482 //===============================================================================
483 void YACSDriver::Texte_HOMARD_Exec_MeshName( const std::string MeshName )
485 MESSAGE("Texte_HOMARD_Exec_MeshName pour "<<MeshName);
487 _Texte += "MeshName = \"" + MeshName + "\"\n" ;
490 //===============================================================================
491 // Manipulation des instructions python - 1
492 // pythonTexte : le texte des instructions python a manipuler
493 // indice : numero de la premiere ligne voulue
494 // concept : nom du concept a inserer
495 //===============================================================================
496 void YACSDriver::Texte_python_1( const std::string pythonTexte, int indice, const std::string concept )
498 MESSAGE("Texte_python_1, pythonTexte\n"<<pythonTexte);
499 MESSAGE("indice = "<<indice<<", concept = "<<concept);
501 // Conversion de type
502 std::istringstream tout (pythonTexte) ;
503 // MESSAGE("\ntout :"<<tout);
504 std::string ligne; // variable contenant chaque ligne de python
505 std::string ligne_bis ; // variable contenant la portion de ligne de python apres '.'
508 while ( std::getline( tout, ligne ) )
512 int position = ligne.find_first_of( "." ) ;
513 // MESSAGE("\nposition : "<< position);
516 ligne_bis = ligne.substr( position );
517 // MESSAGE("\nligne_bis : "<< ligne_bis);
518 _Texte += concept + ligne_bis + "\n" ;
525 //===============================================================================
526 // Manipulation des instructions python - 2
527 // pythonTexte : le texte des instructions python a manipuler
528 // mot_cle : mot-cle dans les lignes a inserer
529 // concept : nom du concept a inserer
530 //===============================================================================
531 void YACSDriver::Texte_python_2( const std::string pythonTexte, const std::string mot_cle, const std::string concept )
533 MESSAGE("Texte_python_2, pythonTexte\n"<<pythonTexte);
534 MESSAGE("mot_cle = "<<mot_cle<<", concept = "<<concept);
536 // Conversion de type
537 std::istringstream tout (pythonTexte) ;
538 // MESSAGE("\ntout :"<<tout);
539 std::string ligne; // variable contenant chaque ligne de python
540 std::string ligne_bis ; // variable contenant la portion de ligne de python apres '.'
541 while ( std::getline( tout, ligne ) )
543 int reperage = ligne.find( mot_cle ) ;
546 int position = ligne.find_first_of( "." ) ;
547 // MESSAGE("\nposition : "<< position);
550 ligne_bis = ligne.substr( position );
551 // MESSAGE("\nligne_bis : "<< ligne_bis);
552 _Texte += concept + ligne_bis + "\n" ;
558 //===============================================================================
559 // Creation d'un parametre
560 //===============================================================================
561 void YACSDriver::TexteParametre( const std::string node, const std::string port, const std::string type_value, const std::string value )
564 // MESSAGE("TexteParametre");
565 _Texte_parametres += " <parameter>\n" ;
566 _Texte_parametres += " <tonode>" + node + "</tonode>" ;
567 _Texte_parametres += "<toport>" + port + "</toport>\n" ;
568 _Texte_parametres += " <value><" + type_value + ">" + value + "</" + type_value + "></value>\n" ;
569 _Texte_parametres += " </parameter>\n" ;
572 //===============================================================================
573 // Ajout des parametres
574 //===============================================================================
575 void YACSDriver::TexteAddParametres( )
578 MESSAGE("TexteAddParametres");
579 TexteAdd(_Texte_parametres) ;
582 //===============================================================================
583 void YACSDriver::CreeFichier( )
586 MESSAGE("CreeFichier sur le fichier "<<_XMLFile);
587 std::ofstream Fic(_XMLFile.c_str(), std::ios::out ) ;
588 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
592 //===============================================================================
593 // REMARQUE : on devrait utiliser le GetStringInTexte de HOMARD_Gen_i mais je ne sais pas
594 // comment l'appeler. ALors je clone.
595 // Recuperation de la chaine de caracteres par rapport l'apparition d'un texte
596 // ligne : la ligne a manipuler
597 // texte : le texte a reperer
598 // option : 0 : la chaine avant le texte
599 // 1 : la chaine apres le texte
600 // Si le texte est absent, on retourne la chaine totale
601 //===============================================================================
602 std::string YACSDriver::GetStringInTexte( const std::string ligne, const std::string texte, int option )
604 // MESSAGE("GetStringInTexte, recherche de '"<<texte<<"' dans '"<<ligne<<"'"<<", option = "<<option);
606 std::string chaine = ligne ;
607 int position = ligne.find_first_of( texte ) ;
610 if ( option == 0 ) { chaine = ligne.substr( 0, position ) ; }
611 else { chaine = ligne.substr( position+1 ) ; }
613 // Conversion de type