18#include <Separateur.h>
49 ostream_ = std::make_unique<ostream>(os.rdbuf());
58 Cerr<<
"we try to copy a Sortie with a non-empty std::ostream!!!"<<finl;
67 ostream_ = std::make_unique<ostream>(os.rdbuf());
75 Cerr<<
"we try to copy a Sortie with a non-empty std::stream!!!"<<finl;
101int Sortie::put(
const unsigned * ob, std::streamsize n, std::streamsize nb_col) {
return put_template<unsigned>(ob,n,nb_col); }
102int Sortie::put(
const int * ob, std::streamsize n, std::streamsize nb_col) {
return put_template<int>(ob,n,nb_col); }
103int Sortie::put(
const long * ob, std::streamsize n, std::streamsize nb_col) {
return put_template<long>(ob,n,nb_col); }
104int Sortie::put(
const long long * ob, std::streamsize n, std::streamsize nb_col) {
return put_template<long long>(ob,n,nb_col); }
105int Sortie::put(
const float * ob, std::streamsize n, std::streamsize nb_col) {
return put_template<float>(ob,n,nb_col); }
106int Sortie::put(
const double * ob, std::streamsize n, std::streamsize nb_col) {
return put_template<double>(ob,n,nb_col); }
156#if defined(__CYGWIN__) || defined(MICROSOFT)
175 Cerr<<
"Sortie::lockfile() : we should not go through it !!"<<finl;
182 Cerr<<
"Sortie::unlockfile() : we should not go through it !!"<<finl;
189 Cerr<<
"Sortie::syncfile() : we should not go through it !!"<<finl;
224 const int n = (int)strlen(ob) + 1;
225 ostream_->write((
char *) ob, n *
sizeof(
char));
260 Cerr<<
"Error you cant change binary format after open "<<finl;
274template<
typename _TYPE_>
275int Sortie::put_template(
const _TYPE_ *ob, std::streamsize n, std::streamsize nb_col)
283 for (
int i = 0; i < n; i++) (*
this) << ob[i];
288 std::streamsize sz =
sizeof(_TYPE_);
290 ostream_->write((
const char*) ob, sz);
295 std::streamsize j = nb_col;
296 for (std::streamsize i = 0; i < n; i++)
298 (*ostream_) << (ob[i]) << (
' ');
302 (*ostream_) << (endl);
307 if (j != nb_col && n > 0) (*ostream_) << (endl);
315template int Sortie::put_template(
const unsigned *ob, std::streamsize n, std::streamsize nb_col);
316template int Sortie::put_template(
const int *ob, std::streamsize n, std::streamsize nb_col);
317template int Sortie::put_template(
const long *ob, std::streamsize n, std::streamsize nb_col);
318template int Sortie::put_template(
const long long *ob, std::streamsize n, std::streamsize nb_col);
319template int Sortie::put_template(
const float *ob, std::streamsize n, std::streamsize nb_col);
320template int Sortie::put_template(
const double *ob, std::streamsize n, std::streamsize nb_col);
328template<
typename _TYPE_>
329Sortie& Sortie::operator_template(
const _TYPE_ &ob)
335 trustIdType val =
static_cast<trustIdType
>(ob);
336 ostream_->write((
char*) &val,
sizeof(trustIdType));
339 ostream_->write((
char*) &ob,
sizeof(_TYPE_));
347template Sortie& Sortie::operator_template(
const unsigned& ob);
348template Sortie& Sortie::operator_template(
const int& ob);
349template Sortie& Sortie::operator_template(
const long& ob);
350template Sortie& Sortie::operator_template(
const long long& ob);
351template Sortie& Sortie::operator_template(
const float& ob);
352template Sortie& Sortie::operator_template(
const double& ob);
353template Sortie& Sortie::operator_template(
const unsigned long& ob);
bool bin_
Is this a binary flux?
bool must_convert() const
Whether to convert an int into a long when reading/writing out data.
classe Objet_U Cette classe est la classe de base des Objets de TRUST
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Separateur pour les fichiers.
const Type & get_type() const
Classe de base des flux de sortie.
virtual int put(const unsigned *ob, std::streamsize n, std::streamsize nb_colonnes=1)
void set_bin(bool bin) override
Change le mode d'ecriture du fichier.
virtual Sortie & unlockfile()
Sortie & operator<<(ostream &(*f)(ostream &))
virtual Sortie & lockfile()
virtual void precision(int)
Sortie & operator=(ostream &os)
virtual int add_col(const double ob)
virtual void setf(IOS_FORMAT)
virtual Sortie & syncfile()
std::unique_ptr< ostream > ostream_