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;
222 const int n = (int)strlen(ob) + 1;
223 ostream_->write((
char *) ob, n *
sizeof(
char));
257 Cerr<<
"Error you cant change binary format after open "<<finl;
271template<
typename _TYPE_>
272int Sortie::put_template(
const _TYPE_ *ob, std::streamsize n, std::streamsize nb_col)
280 for (
int i = 0; i < n; i++) (*
this) << ob[i];
285 std::streamsize sz =
sizeof(_TYPE_);
287 ostream_->write((
const char*) ob, sz);
292 std::streamsize j = nb_col;
293 for (std::streamsize i = 0; i < n; i++)
295 (*ostream_) << (ob[i]) << (
' ');
299 (*ostream_) << (endl);
304 if (j != nb_col && n > 0) (*ostream_) << (endl);
312template int Sortie::put_template(
const unsigned *ob, std::streamsize n, std::streamsize nb_col);
313template int Sortie::put_template(
const int *ob, std::streamsize n, std::streamsize nb_col);
314template int Sortie::put_template(
const long *ob, std::streamsize n, std::streamsize nb_col);
315template int Sortie::put_template(
const long long *ob, std::streamsize n, std::streamsize nb_col);
316template int Sortie::put_template(
const float *ob, std::streamsize n, std::streamsize nb_col);
317template int Sortie::put_template(
const double *ob, std::streamsize n, std::streamsize nb_col);
325template<
typename _TYPE_>
326Sortie& Sortie::operator_template(
const _TYPE_ &ob)
332 trustIdType val =
static_cast<trustIdType
>(ob);
333 ostream_->write((
char*) &val,
sizeof(trustIdType));
336 ostream_->write((
char*) &ob,
sizeof(_TYPE_));
344template Sortie& Sortie::operator_template(
const unsigned& ob);
345template Sortie& Sortie::operator_template(
const int& ob);
346template Sortie& Sortie::operator_template(
const long& ob);
347template Sortie& Sortie::operator_template(
const long long& ob);
348template Sortie& Sortie::operator_template(
const float& ob);
349template Sortie& Sortie::operator_template(
const double& ob);
350template 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.
Base class for TRUST objects (Objet_U).
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Separator for output streams.
const Type & get_type() const
Base class for output streams.
virtual int put(const unsigned *ob, std::streamsize n, std::streamsize nb_colonnes=1)
void set_bin(bool bin) override
Changes the write mode of the file.
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_