267 lines
10 KiB
C
267 lines
10 KiB
C
|
// 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/>.
|
||
|
|
||
|
/************************************************************************
|
||
|
* DATE: 23/01/97 *
|
||
|
* $ *
|
||
|
* AUTEUR: G RIO (mailto:gerardrio56@free.fr) *
|
||
|
* $ *
|
||
|
* PROJET: Herezh++ *
|
||
|
* $ *
|
||
|
************************************************************************
|
||
|
* BUT: création d'un conteneur liste stl, qui comporte en plus *
|
||
|
* une surcharge de lecture écriture. *
|
||
|
* Idem pour LaList. *
|
||
|
* $ *
|
||
|
* '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' *
|
||
|
* MODIFICATIONS: *
|
||
|
* ! date ! auteur ! but ! *
|
||
|
* ------------------------------------------------------------ *
|
||
|
* !24/8/2003! rio ! introduction de LaList ! *
|
||
|
* $ *
|
||
|
************************************************************************/
|
||
|
#ifndef LIST_IO_H
|
||
|
#define LIST_IO_H
|
||
|
|
||
|
#include <iostream>
|
||
|
#include <stdlib.h>
|
||
|
#include <list>
|
||
|
#include <iomanip>
|
||
|
#include "LaList.h"
|
||
|
#include "Sortie.h"
|
||
|
#include "ParaGlob.h"
|
||
|
using namespace std; //introduces namespace std
|
||
|
|
||
|
/** @defgroup Les_list_io
|
||
|
*
|
||
|
* BUT: création de conteneure type listes stl, qui comportent en plus
|
||
|
* une surcharge de lecture écriture.
|
||
|
* Idem pour LaList.
|
||
|
*
|
||
|
*
|
||
|
* \author Gérard Rio
|
||
|
* \version 1.0
|
||
|
* \date 23/01/97
|
||
|
* \brief création de conteneurs type listes stl avec surcharge de lecture écriture
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
|
||
|
/// @addtogroup Les_list_io
|
||
|
/// @{
|
||
|
///
|
||
|
|
||
|
//------------------------------------------------------------------
|
||
|
//! List_io classe template identique à list de stl, avec en plus une lecture et écriture
|
||
|
//------------------------------------------------------------------
|
||
|
/// \author Gérard Rio
|
||
|
/// \version 1.0
|
||
|
/// \date 23/01/97
|
||
|
|
||
|
template <class T>
|
||
|
class List_io : public LaLIST<T>
|
||
|
{ // surcharge de l'operator de lecture
|
||
|
friend istream & operator >> (istream & entree, List_io<T> & )
|
||
|
{ // du au pb de lecture de pointeur
|
||
|
cout << "\n erreur dans la lecture d'une list_io, la methode n'est pas utilisable en template "
|
||
|
<< "\n friend istream & operator >> (... ";
|
||
|
Sortie(1);
|
||
|
return entree;
|
||
|
}
|
||
|
// --- information pour créer un programme de lecture cohérent avec l'écriture ----
|
||
|
// exemple de surcharge de l'operator de lecture
|
||
|
// friend istream & operator >> (istream & entree, List_io& a)
|
||
|
// { string nom; entree >> nom;
|
||
|
// #ifdef MISE_AU_POINT
|
||
|
// if (nom != "debut_List_IO=")
|
||
|
// { cout << "\n erreur dans la lecture d'une list_io, on ne trouve pas le mot cle: debut_List_IO= "
|
||
|
// << "\n friend istream & operator >> (... ";
|
||
|
// Sortie(1);
|
||
|
// }
|
||
|
// #endif
|
||
|
// int taille;entree >> taille; // lecture de la taille
|
||
|
// T un_elem;
|
||
|
// for (int i=1;i<=taille;i++)
|
||
|
// { entree >> un_elem; // lecture
|
||
|
// a.push_back(un_elem); // enregistrement
|
||
|
// }
|
||
|
// return entree;
|
||
|
// }
|
||
|
// fin --- information pour créer un programme de lecture cohérent avec l'écriture ----
|
||
|
|
||
|
// surcharge de l'operator d'ecriture
|
||
|
friend ostream & operator << (ostream & sort, const List_io<T> & a)
|
||
|
{ // tout d'abord un indicateur donnant le type
|
||
|
sort << "\n debut_List_IO= " << "(taille= " << a.size() << " ) ";
|
||
|
typename List_io<T>::const_iterator iter_courant,iter_fin;
|
||
|
iter_fin = a.end();
|
||
|
for (iter_courant=a.begin();iter_courant!=iter_fin;iter_courant++)
|
||
|
{ sort << setprecision(ParaGlob::NbdigdoCA()) << (*iter_courant) ; sort << " "; }
|
||
|
sort << "\n";
|
||
|
return sort;
|
||
|
}
|
||
|
|
||
|
public:
|
||
|
// on définit également une opération de lecture et d'écriture pour
|
||
|
// les itérators, ce qui permettera de créer des tableaux d'iterator
|
||
|
// surcharge de l'operator de lecture, a priori pas utile
|
||
|
friend istream & operator >> (istream & entree, typename LaLIST<T>::iterator& )
|
||
|
{ cout << "erreur, cette surcharge ne doit pas être utilisée "
|
||
|
<< "List_io::iterator, operator << \n";
|
||
|
Sortie(1);
|
||
|
return entree;
|
||
|
}
|
||
|
// surcharge de l'operator d'ecriture, a priori pas utile
|
||
|
friend ostream & operator << (ostream & sort, const typename LaLIST<T>::iterator )
|
||
|
{ cout << "erreur, cette surcharge ne doit pas être utilisée "
|
||
|
<< "List_io::iterator, operator >> \n";
|
||
|
Sortie(1);
|
||
|
return sort;
|
||
|
}
|
||
|
|
||
|
// surcharge de l'operator de lecture, a priori pas utile
|
||
|
friend istream & operator >> (istream & entree, typename LaLIST<T>::const_iterator& )
|
||
|
{ cout << "erreur, cette surcharge ne doit pas être utilisée "
|
||
|
<< "List_io::const_iterator, operator << \n";
|
||
|
Sortie(1);
|
||
|
return entree;
|
||
|
}
|
||
|
// surcharge de l'operator d'ecriture, a priori pas utile
|
||
|
friend ostream & operator << (ostream & sort, const typename LaLIST<T>::const_iterator& )
|
||
|
{ cout << "erreur, cette surcharge ne doit pas être utilisée "
|
||
|
<< "List_io::const_iterator_io, operator >> \n";
|
||
|
Sortie(1);
|
||
|
return sort;
|
||
|
}
|
||
|
|
||
|
public :
|
||
|
// CONSTRUCTEURS :
|
||
|
// List_io (const List_io& li): list(li) {};
|
||
|
// List_io (Allocator<list_node>::size_type n, const T& a): list(n,a) {};
|
||
|
|
||
|
// DESTRUCTEUR :
|
||
|
// METHODES PUBLIQUES :
|
||
|
|
||
|
private :
|
||
|
// VARIABLES PROTEGEES :
|
||
|
// CONSTRUCTEURS :
|
||
|
// DESTRUCTEUR :
|
||
|
// METHODES PROTEGEES :
|
||
|
|
||
|
};
|
||
|
|
||
|
/// @} // end of group
|
||
|
|
||
|
/// @addtogroup Les_list_io
|
||
|
/// @{
|
||
|
///
|
||
|
|
||
|
//------------------------------------------------------------------
|
||
|
//! LaLIST_io classe template identique à List_io: existe pour des raisons historiques et en prévision de changements futurs éventuelles (?)
|
||
|
//------------------------------------------------------------------
|
||
|
/// \author Gérard Rio
|
||
|
/// \version 1.0
|
||
|
/// \date 24/8/2003
|
||
|
|
||
|
// idem pour LaList
|
||
|
|
||
|
template <class T>
|
||
|
class LaLIST_io : public LaLIST<T>
|
||
|
{ // surcharge de l'operator de lecture
|
||
|
friend istream & operator >> (istream & entree, LaLIST_io<T>& )
|
||
|
// l'opérateur de lecture n'est pas surchargeable car on n'a pas de
|
||
|
// critére d'arrêt de la lecture (on en faire mais pour l'instant pas
|
||
|
// utile
|
||
|
{ cout << "erreur, cette surcharge ne doit pas être utilisée "
|
||
|
<< "LaLIST_io, operator >> \n";
|
||
|
Sortie(1);
|
||
|
return entree;
|
||
|
}
|
||
|
// surcharge de l'operator d'ecriture
|
||
|
friend ostream & operator << (ostream & sort, const LaLIST_io<T>& a)
|
||
|
{ // tout d'abord un indicateur donnant le type
|
||
|
sort << "\nLaLIST_IO= ";
|
||
|
typename LaLIST_io<T>::const_iterator iter_courant,iter_fin;
|
||
|
iter_fin = a.end();
|
||
|
for (iter_courant=a.begin();iter_courant!=iter_fin;iter_courant++)
|
||
|
{ sort << setw (22) << (*iter_courant) ; sort << " "; }
|
||
|
sort << "\n";
|
||
|
return sort;
|
||
|
}
|
||
|
|
||
|
public:
|
||
|
// on définit également une opération de lecture et d'écriture pour
|
||
|
// les itérators, ce qui permettera de créer des tableaux d'iterator
|
||
|
// surcharge de l'operator de lecture, a priori pas utile
|
||
|
friend istream & operator >> (istream & entree, typename LaLIST<T>::iterator& )
|
||
|
{ cout << "erreur, cette surcharge ne doit pas être utilisée "
|
||
|
<< "LaLIST_io::iterator, operator << \n";
|
||
|
Sortie(1);
|
||
|
return entree;
|
||
|
}
|
||
|
// surcharge de l'operator d'ecriture, a priori pas utile
|
||
|
friend ostream & operator << (ostream & sort, const typename LaLIST<T>::iterator )
|
||
|
{ cout << "erreur, cette surcharge ne doit pas être utilisée "
|
||
|
<< "LaLIST_io::iterator, operator >> \n";
|
||
|
Sortie(1);
|
||
|
return sort;
|
||
|
}
|
||
|
|
||
|
// surcharge de l'operator de lecture, a priori pas utile
|
||
|
friend istream & operator >> (istream & entree, typename LaLIST<T>::const_iterator& )
|
||
|
{ cout << "erreur, cette surcharge ne doit pas être utilisée "
|
||
|
<< "LaLIST_io::const_iterator, operator << \n";
|
||
|
Sortie(1);
|
||
|
return entree;
|
||
|
}
|
||
|
// surcharge de l'operator d'ecriture, a priori pas utile
|
||
|
friend ostream & operator << (ostream & sort, const typename LaLIST<T>::const_iterator& )
|
||
|
{ cout << "erreur, cette surcharge ne doit pas être utilisée "
|
||
|
<< "LaLIST_io::const_iterator_io, operator >> \n";
|
||
|
Sortie(1);
|
||
|
return sort;
|
||
|
}
|
||
|
|
||
|
public :
|
||
|
// CONSTRUCTEURS :
|
||
|
// DESTRUCTEUR :
|
||
|
// METHODES PUBLIQUES :
|
||
|
|
||
|
private :
|
||
|
// VARIABLES PROTEGEES :
|
||
|
// CONSTRUCTEURS :
|
||
|
// DESTRUCTEUR :
|
||
|
// METHODES PROTEGEES :
|
||
|
|
||
|
};
|
||
|
/// @} // end of group
|
||
|
|
||
|
|
||
|
|
||
|
#endif
|