TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Entree Class Reference

Class defining operators and methods for all reading operation in an input flow (file, keyboard communication buffer, etc.). More...

#include <Entree.h>

Inheritance diagram for Entree:
[legend]
Collaboration diagram for Entree:
[legend]

Public Types

enum  Error_Action { ERROR_EXIT , ERROR_CONTINUE , ERROR_EXCEPTION }

Public Member Functions

 Entree ()
 Entree (istream &is)
 Entree (const Entree &is)
virtual ~Entree ()
void set_bin (bool bin) override
 Change le mode d'ecriture du fichier.
Entreeoperator= (istream &is)
Entreeoperator= (Entree &is)
virtual istream & get_istream ()
virtual const istream & get_istream () const
void set_istream (istream *is)
Entreeoperator>> (Entree &(*f)(Entree &))
Entreeoperator>> (istream &(*f)(istream &))
Entreeoperator>> (ios &(*f)(ios &))
template<typename T>
Entreeoperator>> (const TRUST_Ref< T > &)
Entreeoperator>> (const TRUST_Ref_Objet_U &)
virtual Entreeoperator>> (int &ob)
virtual Entreeoperator>> (long &ob)
virtual Entreeoperator>> (long long &ob)
virtual Entreeoperator>> (float &ob)
virtual Entreeoperator>> (double &ob)
virtual Entreeoperator>> (std::string &ob)
virtual Entreeoperator>> (Objet_U &ob) final
virtual int get (int *ob, std::streamsize n)
virtual int get (long *ob, std::streamsize n)
virtual int get (long long *ob, std::streamsize n)
virtual int get (float *ob, std::streamsize n)
virtual int get (double *ob, std::streamsize n)
virtual int get (char *buf, std::streamsize bufsize)
 Lecture d'une chaine dans ostream_ bufsize est la taille du buffer alloue pour ob (y compris.
virtual int eof ()
virtual int jumpOfLines ()
virtual int fail ()
virtual int good ()
virtual void set_check_types (bool flag)
 indique si le stream doit verifier les types des objets lus (ints et nombres flottants).
bool check_types () const
virtual void set_error_action (Error_Action)
 Change le comportement en cas d'erreur de l'entree, voir error_handle_() et get_error_action().
Error_Action get_error_action ()
 renvoie error_action_ pour cette entree (permet de la modifier et de restaurer ensuite la valeur anterieure)
 operator istream & ()
istream & putback (char ch)
bool get_diffuse ()
virtual void set_diffuse (bool diffuse)
 ToDo TMA : commenter.
Public Member Functions inherited from AbstractIO
bool is_64b () const
virtual void set_64b (bool is_64b)
bool is_bin ()
void set_avoid_conversion (bool avoid)
bool avoid_conversion ()

Protected Member Functions

int error_handle (int fail_flag)
virtual int error_handle_ (int fail_flag)
 Cette fonction est appellee par operateur>>, get, get_nom ouvrir, fermer, lire, etc.
Protected Member Functions inherited from AbstractIO
 AbstractIO ()
virtual ~AbstractIO ()
template<typename _TYPE_>
bool must_convert () const
 Whether to convert an int into a long when reading/writing out data.

Protected Attributes

bool check_types_ = false
Error_Action error_action_
bool diffuse_
Protected Attributes inherited from AbstractIO
bool bin_ = false
 Is this a binary flux?
bool is_64b_
 Will we be reading/writing in 64b? (Init in ctor to avoid including arch.h probably).
bool avoid_conversion_ = false

Detailed Description

Class defining operators and methods for all reading operation in an input flow (file, keyboard communication buffer, etc.).

See also
Sortie

Definition at line 41 of file Entree.h.

Member Enumeration Documentation

◆ Error_Action

Enumerator
ERROR_EXIT 
ERROR_CONTINUE 
ERROR_EXCEPTION 

Definition at line 93 of file Entree.h.

Constructor & Destructor Documentation

◆ Entree() [1/3]

Entree::Entree ( )

Definition at line 24 of file Entree.cpp.

◆ Entree() [2/3]

Entree::Entree ( istream & is)

Definition at line 31 of file Entree.cpp.

◆ Entree() [3/3]

Entree::Entree ( const Entree & is)

Definition at line 36 of file Entree.cpp.

◆ ~Entree()

Entree::~Entree ( )
virtual

Definition at line 277 of file Entree.cpp.

Member Function Documentation

◆ check_types()

bool Entree::check_types ( ) const
inline

Definition at line 92 of file Entree.h.

◆ eof()

int Entree::eof ( )
virtual

Reimplemented in Entree_complete, Entree_Fichier_base, and Lec_Diffuse_base.

Definition at line 256 of file Entree.cpp.

◆ error_handle()

int Entree::error_handle ( int fail_flag)
inlineprotected

Definition at line 105 of file Entree.h.

◆ error_handle_()

int Entree::error_handle_ ( int fail_flag)
protectedvirtual

Cette fonction est appellee par operateur>>, get, get_nom ouvrir, fermer, lire, etc.

.. en cas d'echec (lorsque fail() est mis) Elle renvoie 0 s'il y a eu une erreur (passer par error_handle() qui traite en inline le cas ou il n'y a pas d'erreur), et 1 s'il n'y a pas d'erreur. (par commodite de codage des methodes qui l'utilisent, on ecrira "return error_handle(fail());" Elle peut etre configuree pour

  • renvoyer "0" en cas d'erreur et continuer l'execution du code (cas d'un ancien code qui ne gere pas les exceptions mais teste le drapeau fail() de temps en temps) Dans ce cas les methodes operator>> continuent l'execution du code meme en cas d'echec, le contenu des variables lues est indefini !
  • faire Process::exit() (cas d'une portion de code dans laquelle on ne veut pas faire de gestion d'erreur du tout et ou on suppose que tout va toujours bien)
  • lever une exception (permet une gestion rigoureuse des erreurs et une information utilisateur optimale en fonction du contexte)
See also
set_error_action()

Definition at line 342 of file Entree.cpp.

◆ fail()

int Entree::fail ( )
virtual

Reimplemented in Entree_complete, Entree_Fichier_base, and Lec_Diffuse_base.

Definition at line 263 of file Entree.cpp.

◆ get() [1/6]

int Entree::get ( char * ob,
std::streamsize bufsize )
virtual

Lecture d'une chaine dans ostream_ bufsize est la taille du buffer alloue pour ob (y compris.

le caractere 0 final). La chaine contient toujours un 0 meme en cas d'echec. La methode renvoie 1 si la lecture est bonne, 0 sinon. Si le buffer est trop petit, pour l'instant on fait exit() mais par la suite on pourra tester: si strlen(ob)==bufsize-1, alors refaire lire() jusqu'a arriver au bout. Si le lire() suivant renvoie une chaine de longueur nulle, cela signifie que la taille de la chaine etait exactement bufsize-1. Attention: le comportement est different en binaire et en ascii. En binaire, on lit la chaine jusqu'au prochain '\0'. En ascii, on lit la chaine jusqu'au prochain separateur (espace, tab, fin ligne)

Reimplemented in EChaineJDD, Entree_complete, and Lec_Diffuse_base.

Definition at line 103 of file Entree.cpp.

◆ get() [2/6]

int Entree::get ( double * ob,
std::streamsize n )
virtual

Reimplemented in EChaineJDD, Entree_complete, and Lec_Diffuse_base.

Definition at line 219 of file Entree.cpp.

◆ get() [3/6]

int Entree::get ( float * ob,
std::streamsize n )
virtual

Reimplemented in EChaineJDD, Entree_complete, and Lec_Diffuse_base.

Definition at line 225 of file Entree.cpp.

◆ get() [4/6]

int Entree::get ( int * ob,
std::streamsize n )
virtual

Reimplemented in EChaineJDD, Entree_complete, and Lec_Diffuse_base.

Definition at line 222 of file Entree.cpp.

◆ get() [5/6]

int Entree::get ( long * ob,
std::streamsize n )
virtual

Reimplemented in EChaineJDD, Entree_complete, and Lec_Diffuse_base.

Definition at line 228 of file Entree.cpp.

◆ get() [6/6]

int Entree::get ( long long * ob,
std::streamsize n )
virtual

Reimplemented in EChaineJDD, Entree_complete, and Lec_Diffuse_base.

Definition at line 231 of file Entree.cpp.

◆ get_diffuse()

bool Entree::get_diffuse ( )
inline

Definition at line 99 of file Entree.h.

◆ get_error_action()

Entree::Error_Action Entree::get_error_action ( )

renvoie error_action_ pour cette entree (permet de la modifier et de restaurer ensuite la valeur anterieure)

Definition at line 374 of file Entree.cpp.

◆ get_istream() [1/2]

istream & Entree::get_istream ( )
virtual

Reimplemented in LecFicDiffuse.

Definition at line 41 of file Entree.cpp.

◆ get_istream() [2/2]

const istream & Entree::get_istream ( ) const
virtual

Reimplemented in LecFicDiffuse.

Definition at line 46 of file Entree.cpp.

◆ good()

int Entree::good ( )
virtual

Reimplemented in Entree_complete, Entree_Fichier_base, and Lec_Diffuse_base.

Definition at line 270 of file Entree.cpp.

◆ jumpOfLines()

int Entree::jumpOfLines ( )
virtual

Definition at line 238 of file Entree.cpp.

◆ operator istream &()

Entree::operator istream & ( )
inline

Definition at line 97 of file Entree.h.

◆ operator=() [1/2]

Entree & Entree::operator= ( Entree & is)

Definition at line 80 of file Entree.cpp.

◆ operator=() [2/2]

Entree & Entree::operator= ( istream & is)

Definition at line 72 of file Entree.cpp.

◆ operator>>() [1/12]

template<typename T>
Entree & Entree::operator>> ( const TRUST_Ref< T > & )
inline

Definition at line 65 of file Entree.h.

◆ operator>>() [2/12]

Entree & Entree::operator>> ( const TRUST_Ref_Objet_U & )
inline

Definition at line 67 of file Entree.h.

◆ operator>>() [3/12]

Entree & Entree::operator>> ( double & ob)
virtual

Reimplemented in EChaineJDD, Entree_complete, and Lec_Diffuse_base.

Definition at line 216 of file Entree.cpp.

◆ operator>>() [4/12]

Entree & Entree::operator>> ( Entree &(* )(Entree &))

Definition at line 55 of file Entree.cpp.

◆ operator>>() [5/12]

Entree & Entree::operator>> ( float & ob)
virtual

Reimplemented in EChaineJDD, Entree_complete, and Lec_Diffuse_base.

Definition at line 224 of file Entree.cpp.

◆ operator>>() [6/12]

Entree & Entree::operator>> ( int & ob)
virtual

Reimplemented in EChaineJDD, Entree_complete, and Lec_Diffuse_base.

Definition at line 221 of file Entree.cpp.

◆ operator>>() [7/12]

Entree & Entree::operator>> ( ios &(* )(ios &))

Definition at line 65 of file Entree.cpp.

◆ operator>>() [8/12]

Entree & Entree::operator>> ( istream &(* )(istream &))

Definition at line 60 of file Entree.cpp.

◆ operator>>() [9/12]

Entree & Entree::operator>> ( long & ob)
virtual

Reimplemented in EChaineJDD, Entree_complete, and Lec_Diffuse_base.

Definition at line 227 of file Entree.cpp.

◆ operator>>() [10/12]

Entree & Entree::operator>> ( long long & ob)
virtual

Reimplemented in EChaineJDD, Entree_complete, and Lec_Diffuse_base.

Definition at line 230 of file Entree.cpp.

◆ operator>>() [11/12]

Entree & Entree::operator>> ( Objet_U & ob)
finalvirtual

Reimplemented in EChaineJDD, Entree_complete, and Lec_Diffuse_base.

Definition at line 236 of file Entree.cpp.

◆ operator>>() [12/12]

Entree & Entree::operator>> ( std::string & ob)
virtual

Reimplemented in EChaineJDD, Entree_complete, and Lec_Diffuse_base.

Definition at line 234 of file Entree.cpp.

◆ putback()

istream & Entree::putback ( char ch)
inline

Definition at line 98 of file Entree.h.

◆ set_bin()

void Entree::set_bin ( bool bin)
overridevirtual

Change le mode d'ecriture du fichier.

Cette methode peut etre appelee n'importe quand.

Reimplemented from AbstractIO.

Reimplemented in Entree_Brute, Entree_complete, and Lec_Diffuse_base.

Definition at line 291 of file Entree.cpp.

◆ set_check_types()

void Entree::set_check_types ( bool flag)
virtual

indique si le stream doit verifier les types des objets lus (ints et nombres flottants).

Exemple : l'entree contient 123.456 123.456 int i; check_types(0); is >> i; // i contient 123 check_types(1); is >> i; // Erreur : on lit la chaine 123.456 et on essaye de la convertir en int Voir operator>>(int &)

Reimplemented in Entree_complete, and Lec_Diffuse_base.

Definition at line 313 of file Entree.cpp.

◆ set_diffuse()

void Entree::set_diffuse ( bool diffuse)
virtual

ToDo TMA : commenter.

Reimplemented in Lec_Diffuse_base.

Definition at line 410 of file Entree.cpp.

◆ set_error_action()

void Entree::set_error_action ( Entree::Error_Action action)
virtual

Change le comportement en cas d'erreur de l'entree, voir error_handle_() et get_error_action().

Reimplemented in Entree_complete.

Definition at line 382 of file Entree.cpp.

◆ set_istream()

void Entree::set_istream ( istream * is)

Definition at line 50 of file Entree.cpp.

Member Data Documentation

◆ check_types_

bool Entree::check_types_ = false
protected

Definition at line 112 of file Entree.h.

◆ diffuse_

bool Entree::diffuse_
protected

Definition at line 114 of file Entree.h.

◆ error_action_

Error_Action Entree::error_action_
protected

Definition at line 113 of file Entree.h.


The documentation for this class was generated from the following files:
  • /home/docs/checkouts/readthedocs.org/user_builds/cea-trust-platform/checkouts/master/src/Kernel/Utilitaires/Entree.h
  • /home/docs/checkouts/readthedocs.org/user_builds/cea-trust-platform/checkouts/master/src/Kernel/Utilitaires/Entree.cpp