2 // File : HomardConfigFile.cxx
3 // Author : Paul RASCLE, EDF
5 // cree un fichier de configuration HOMARD
9 #include "HomardConfigFile.hxx"
10 #include "utilities.h"
20 //=============================================================================
24 //=============================================================================
26 HomardConfigFile::HomardConfigFile():
27 _nomFichier(string("HOMARD.Configuration")),
31 string t1[] = {string("CCMaiN__"), string("CCNoMN__"), string("CCSolN__"), string("CCFronti"),
32 string("HOMaiN__"), string("RenumN__"), string("ListeStd"), string("PPBasFic"),
33 string("CCAssoci"), string("NumeIter"), string("CCMaiNP1"), string("CCNoMNP1"),
34 string("TypeElem"), string("TypeRaff"), string("TypeDera"), string("HOMaiN__"),
35 string("HOMaiNP1"), string("CCNoChaI"), string("CCCoChaI"), string("CCNumOrI"),
36 string("CCNumPTI"), string("SeuilBPE"), string("SeuilHPE"), string("CCIndica")};
37 std::list<motcle> l1(t1,t1+24);
38 _motscle_ss_valeur=l1;
40 string t2[] = {string("Aucun0__"), string("Nb_Enti2"), string("Interpe3"), string("Qualite5"),
41 string("Nb_Enti7"), string("Connex11"), string("Taille13") };
42 std::list<motcle> l2(t2,t2+7);
45 string t3[] = {string("ModeHOMA"), string("EcriFiHO")};
46 std::list<motcle> l3(t3,t3+2);
49 _dictValeur[string("Nb_Enti2")]=string("oui") ;
51 _dictValeuroui[string("Aucun0__")]=0;
52 _dictValeuroui[string("Nb_Enti2")]=2;
53 _dictValeuroui[string("Interpe3")]=3;
54 _dictValeuroui[string("Qualite5")]=5;
55 _dictValeuroui[string("Nb_Enti7")]=7;
56 _dictValeuroui[string("Connex11")]=11;
57 _dictValeuroui[string("Taille13")]=13;
60 //=============================================================================
64 //=============================================================================
65 HomardConfigFile::~HomardConfigFile()
68 //=============================================================================
72 //=============================================================================
73 void HomardConfigFile::setBilan(bool etat)
77 //=============================================================================
81 //=============================================================================
82 bool HomardConfigFile::initVal(const string motclef ,const string valeur)
87 if ( cherche_dans_liste(_motscle_ss_valeur, motclef))
89 _dictValeur[motclef]=valeur;
94 if ( cherche_dans_liste(_motscle_oui_non,motclef))
96 if (valeur =="oui" || valeur == "non")
98 _dictValeur[motclef]=valeur;
103 if ( cherche_dans_liste(_motscle_autre,motclef))
104 // Il faudrait avoir un mecanisme de verification de la valeur //
105 // passee, non mis en place actuellement avec des strings ? //
107 _dictValeur[motclef]=valeur;
114 //=============================================================================
118 //=============================================================================
119 bool HomardConfigFile::cherche_dans_liste(std::list<motcle> & liste, const motcle motclef )
122 std::list<motcle>::iterator it =liste.begin();
123 while ( it != liste.end())
135 //=============================================================================
139 //=============================================================================
140 string HomardConfigFile::getMyDir()
144 //=============================================================================
148 //=============================================================================
149 bool HomardConfigFile::createFile()
153 const char *a = "/tmp/ed.XXXXXX";
154 char * cible = new char[15];
158 _myDir = string(cible);
159 string myfile=_myDir+string("/HOMARD.Configuration");
164 ofstream ficHomard( myfile.c_str()) ;
167 std::map<motcle,valeur>::iterator it = _dictValeur.begin();
168 for (; it != _dictValeur.end(); it++)
170 motcle motclef=(*it).first;
171 valeur valmot =(*it).second;
172 if ( cherche_dans_liste(_motscle_oui_non,motclef))
176 typeBilan=typeBilan*_dictValeuroui[motclef];
180 ficHomard << motclef << " " << valmot << std::endl ;
185 ficHomard << "TypeBila "<< typeBilan << std::endl ;