Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Kernel/IJK/Framework/LecFicDistribue_sansnum.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2025, CEA
* Copyright (c) 2026, CEA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand All @@ -19,7 +19,7 @@

LecFicDistribue_sansnum::LecFicDistribue_sansnum(int)
{
bin_=0;
set_bin(false);
}
LecFicDistribue_sansnum::LecFicDistribue_sansnum():EFichier()
{}
Expand Down
4 changes: 2 additions & 2 deletions src/Kernel/Utilitaires/EChaine.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2022, CEA
* Copyright (c) 2026, CEA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -35,6 +35,6 @@ void EChaine::init(const char *str)
if (istrstream_)
delete istrstream_;
istrstream_ = new istringstream(str); // a copy of str is taken
set_istream(istrstream_);
attach(*istrstream_);
}

10 changes: 5 additions & 5 deletions src/Kernel/Utilitaires/EChaine.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2022, CEA
* Copyright (c) 2026, CEA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand All @@ -19,11 +19,11 @@
#include <Entree.h>
#include <sstream>
using std::istringstream;
/*! @brief An input stream whose source is a character string.
/*! @brief Une entree dont la source est une chaine de caracteres.
*
* The constructor creates its own copy of the string, so that
* the original string can be modified afterwards without modifying
* the EChaine.
* Le constructeur cree sa propre copie de la chaine, de sorte
* que la chaine d'origine peut etre modifiee ensuite sans modifier
* la EChaine.
*
*/

Expand Down
11 changes: 8 additions & 3 deletions src/Kernel/Utilitaires/EChaineJDD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,21 @@ EChaineJDD::EChaineJDD(const char* str) :
init(str);
}

EChaineJDD::~EChaineJDD() { }
EChaineJDD::~EChaineJDD() {
if (istrstream_)
delete istrstream_;
}

void EChaineJDD::init(const char *str)
{
if (istrstream_)
delete istrstream_;
istrstream_ = new istringstream(str); // a copy of str is taken
set_istream(istrstream_);
attach(*istrstream_);
}

Entree& EChaineJDD::operator>>(int& ob) { return operator_template<int>(ob); }
/*
Entree& EChaineJDD::operator>>(True_int& ob) { return operator_template<True_int>(ob); }
Entree& EChaineJDD::operator>>(double& ob) { return operator_template<double>(ob); }

int EChaineJDD::get(char *ob, std::streamsize bufsize)
Expand All @@ -54,3 +58,4 @@ int EChaineJDD::get(char *ob, std::streamsize bufsize)
int ret = Entree::get(ob,bufsize);
return ret;
}
*/
16 changes: 13 additions & 3 deletions src/Kernel/Utilitaires/EChaineJDD.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
#ifndef EChaineJDD_included
#define EChaineJDD_included

#include <cassert>

#include <arch.h>
#include <Entree.h>
#include <sstream>
using std::istringstream;
Expand All @@ -34,11 +37,18 @@ class EChaineJDD : public Entree
~EChaineJDD() override;
void init(const char *str);


#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wextra"
EChaineJDD(const EChaineJDD& other): Input(dynamic_cast<const Input&>(other)) {}
EChaineJDD(EChaineJDD& other): Input(dynamic_cast<Input&>(other)) {}
#pragma GCC diagnostic pop

using Entree::operator>>;
using Entree::get;
Entree& operator>>(int& ob) override;
Entree& operator>>(double& ob) override;
int get(char *ob, std::streamsize bufsize) override;
//Entree& operator>>(True_int& ob) override;
//Entree& operator>>(double& ob) override;
//int get(char *ob, std::streamsize bufsize) override;

void set_track_lines(bool b) { track_lines_ = b ;}

Expand Down
5 changes: 3 additions & 2 deletions src/Kernel/Utilitaires/EFichier.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2023, CEA
* Copyright (c) 2026, CEA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand All @@ -13,11 +13,12 @@
*
*****************************************************************************/

#include <Entree.h>
#include <EFichier.h>

Implemente_instanciable(EFichier,"EFichier",Entree_Fichier_base);

EFichier::EFichier(const char* name,IOS_OPEN_MODE mode) :Entree_Fichier_base(name,mode)
EFichier::EFichier(const char* name,IOS_OPEN_MODE mode_) :Entree_Fichier_base(name,mode_)
{
if (Process::me()>1)
{
Expand Down
23 changes: 19 additions & 4 deletions src/Kernel/Utilitaires/EFichier.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2022, CEA
* Copyright (c) 2026, CEA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand All @@ -17,19 +17,34 @@
#define EFichier_included


#include <arch.h>
#include <Entree_Fichier_base.h>
#include <Declare_Inst.h>

/*! @brief File for reading. This class is to the C++ ifstream class what the Entree class is to the
/*! @brief Fichier en lecture Cette classe est a la classe C++ ifstream ce que la classe Entree est a la
*
* C++ istream class. It virtually redefines the read operators for a file.
* classe C++ istream. Elle redefinit de facon virtuelle les operateurs de lecture dans un fichier.
*
*/

class EFichier : public Entree_Fichier_base
{

Declare_instanciable(EFichier);

public:
EFichier(const char* name,IOS_OPEN_MODE mode=ios::in);

using Entree_Fichier_base::Entree_Fichier_base;
using Input::operator>>;

EFichier(const char* name,IOS_OPEN_MODE mode=std::ios::in);


#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wextra"
EFichier(const EFichier& other): Entree_Fichier_base(dynamic_cast<const Entree_Fichier_base&>(other)) {}
EFichier(EFichier& other): Entree_Fichier_base(dynamic_cast<Entree_Fichier_base&>(other)) {}
#pragma GCC diagnostic pop
};

#endif
22 changes: 14 additions & 8 deletions src/Kernel/Utilitaires/EFichierBin.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2022, CEA
* Copyright (c) 2026, CEA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand All @@ -21,7 +21,7 @@
#include <EntreeSortie.h>
#include <Process.h>

/*! @brief Reading from a file of objects written in binary format.
/*! @brief Lecture dans un fichier d'objets ecrits au format binaire
*
* @sa SFichierBin EFichier
*/
Expand All @@ -34,17 +34,23 @@ class EFichierBin : public EFichier
{
set_bin(1);
};
EFichierBin(const char* name,IOS_OPEN_MODE mode=ios::in)
{
ifstream_=0;
EFichierBin(const char* name,IOS_OPEN_MODE mode_=ios::in) {
// do not use the EFichier opener because it is limited to serial cases
set_bin(1);
ouvrir(name,mode);
if(ifstream_->fail())
ouvrir(name,mode_);
if(fail())
{
Cerr << "Error while opening the file " << name << finl;
Process::exit();
}
};
}


#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wextra"
EFichierBin(const EFichierBin& other): EFichier(dynamic_cast<const EFichier&>(other)) {}
EFichierBin(EFichierBin& other): EFichier(dynamic_cast<EFichier&>(other)) {}
#pragma GCC diagnostic pop
};


Expand Down
Loading