116 lines
3.2 KiB
C++
116 lines
3.2 KiB
C++
|
// FICHIER : Enum_crista.cc
|
||
|
|
||
|
|
||
|
// 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) <https://www.irdl.fr/>.
|
||
|
//
|
||
|
// 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 <https://www.gnu.org/licenses/>.
|
||
|
//
|
||
|
// For more information, please consult: <https://herezh.irdl.fr/>.
|
||
|
|
||
|
|
||
|
#include "Enum_crista.h"
|
||
|
|
||
|
|
||
|
# include <iostream>
|
||
|
using namespace std; //introduces namespace std
|
||
|
#include <stdlib.h>
|
||
|
#include "Sortie.h"
|
||
|
//#ifdef SYSTEM_MAC_OS_X
|
||
|
// #include <stringfwd.h> // a priori ce n'est pas portable
|
||
|
//#el
|
||
|
#if defined SYSTEM_MAC_OS_CARBON
|
||
|
#include <stringfwd.h> // a priori ce n'est pas portable
|
||
|
#else
|
||
|
#include <string.h> // pour le flot en memoire centrale
|
||
|
#endif
|
||
|
#include <string>
|
||
|
|
||
|
|
||
|
|
||
|
char* Nom_Enum_crista (Enum_crista id_Enum_crista)
|
||
|
// Retourne le nom du type de Enum_crista correspondant a l'identificateur
|
||
|
// de type enumere id_Enum_crista
|
||
|
{
|
||
|
|
||
|
char* result;
|
||
|
switch (id_Enum_crista)
|
||
|
{
|
||
|
case HOFFMAN :
|
||
|
result="HOFFMAN";
|
||
|
break;
|
||
|
case HOFFMAN2 :
|
||
|
result="HOFFMAN2";
|
||
|
break;
|
||
|
case CRISTA_PAS_DEFINI :
|
||
|
result="CRISTA_PAS_DEFINI";
|
||
|
break;
|
||
|
default :
|
||
|
cout << "\nErreur : valeur incorrecte du type Enum_crista !\n";
|
||
|
cout << "Nom_Enum_crista(Enum_crista ) \n";
|
||
|
Sortie(1);
|
||
|
};
|
||
|
return result;
|
||
|
|
||
|
};
|
||
|
|
||
|
Enum_crista Id_nom_Enum_crista (const char* nom_Enum_crista)
|
||
|
// Retourne la variable de type enumere associe au nom
|
||
|
// de Enum_crista nom_Enum_crista
|
||
|
{
|
||
|
|
||
|
Enum_crista result;
|
||
|
if ( strcmp(nom_Enum_crista,"HOFFMAN")==0 )
|
||
|
result=HOFFMAN;
|
||
|
else if ( strcmp(nom_Enum_crista,"HOFFMAN2")==0 )
|
||
|
result=HOFFMAN2;
|
||
|
else if ( strcmp(nom_Enum_crista,"CRISTA_PAS_DEFINI")==0 )
|
||
|
result=CRISTA_PAS_DEFINI;
|
||
|
else
|
||
|
{
|
||
|
cout << "\nErreur : nom de Enum_crista inconnu !\n";
|
||
|
cout << "Id_nom_Enum_crista(char* ) \n";
|
||
|
Sortie(1);
|
||
|
};
|
||
|
return result;
|
||
|
|
||
|
};
|
||
|
|
||
|
// surcharge de la lecture
|
||
|
istream & operator >> (istream & entree, Enum_crista & result)
|
||
|
{ char nom_Enum_crista[45];
|
||
|
entree >> nom_Enum_crista;
|
||
|
result = Id_nom_Enum_crista ( nom_Enum_crista);
|
||
|
return entree;
|
||
|
};
|
||
|
|
||
|
|
||
|
// surcharge de l'operator d'ecriture
|
||
|
ostream & operator << (ostream & sort, const Enum_crista& a)
|
||
|
{ // on ecrit la forme caractère
|
||
|
sort << Nom_Enum_crista(a) << " ";
|
||
|
return sort;
|
||
|
};
|
||
|
|