// FICHIER : EnumTypeViteRotat.cp // This file is part of the Herezh++ application. // // The finite element software Herezh++ is dedicated to the field // of mechanics for large transformations of solid structures. // It is developed by Gérard Rio (APP: IDDN.FR.010.0106078.000.R.P.2006.035.20600) // INSTITUT DE RECHERCHE DUPUY DE LÔME (IRDL) . // // Herezh++ is distributed under GPL 3 license ou ultérieure. // // Copyright (C) 1997-2021 Université Bretagne Sud (France) // AUTHOR : Gérard Rio // E-MAIL : gerardrio56@free.fr // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, // or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // See the GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // // For more information, please consult: . #include "EnumTypeViteRotat.h" # include using namespace std; //introduces namespace std #include #include "Sortie.h" //#ifdef SYSTEM_MAC_OS_X // #include // a priori ce n'est pas portable //#el #if defined SYSTEM_MAC_OS_CARBON #include // a priori ce n'est pas portable #else #include // pour le flot en memoire centrale #endif #include char* Nom_TypeViteRotat (const EnumTypeViteRotat id_TypeViteRotat) // Retourne le nom du type de vitesse de rotation correspondant a l'identificateur // de type enumere id_TypeViteRotat { char* result; switch (id_TypeViteRotat) { case R_CORROTATIONNEL : result="R_CORROTATIONNEL"; break; case R_REF_ROT_PROPRE : result="R_REF_ROT_PROPRE"; break; case R_ROT_LOGARITHMIQUE : result="R_ROT_LOGARITHMIQUE"; break; default : cout << "\nErreur : valeur incorrecte du type EnumTypeViteRotat !\n"; cout << "Nom_TypeViteRotat(EnumTypeViteRotat ) \n"; Sortie(1); }; return result; }; EnumTypeViteRotat Id_nom_TypeViteRotat (const char* nom_TypeViteRotat) // Retourne la variable de type enumere associe au nom // de type de vitesse de rotation nom_TypeViteRotat { EnumTypeViteRotat result; if ( strcmp(nom_TypeViteRotat,"R_CORROTATIONNEL")==0 ) result=R_CORROTATIONNEL; else if ( strcmp(nom_TypeViteRotat,"R_REF_ROT_PROPRE")==0 ) result=R_REF_ROT_PROPRE; else if ( strcmp(nom_TypeViteRotat,"R_ROT_LOGARITHMIQUE")==0 ) result=R_ROT_LOGARITHMIQUE; else { cout << "\nErreur : nom de type de vitesse de deformation inconnu !\n"; cout << "Id_nom_TypeViteRotat(char* ) \n"; Sortie(1); }; return result; }; // surcharge de la lecture istream & operator >> (istream & entree, EnumTypeViteRotat & result) { char nom_TypeViteRotat[35]; entree >> nom_TypeViteRotat; result = Id_nom_TypeViteRotat ( nom_TypeViteRotat); return entree; }; // surcharge de l'operator d'ecriture ostream & operator << (ostream & sort, const EnumTypeViteRotat& a) { // on ecrit la forme caractère sort << Nom_TypeViteRotat(a) << " "; return sort; };