Skip to content
Snippets Groups Projects
Commit 49345675 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add possibility to silent outputs or to redirect them

This is made in view of parallelism. One will be able to silent processors
or/and produce file output
parent 077ec470
No related branches found
No related tags found
1 merge request!9Feature/io
This commit is part of merge request !9. Comments created here will be created in the context of that merge request.
#include <PastisOStream.hpp> #include <PastisOStream.hpp>
#include <sstream>
#include <iomanip>
PastisOStream pout(std::cout); PastisOStream pout(std::cout);
PastisOStream perr(std::cerr); PastisOStream perr(std::cerr);
std::stringstream null_stream;
const PastisOStream _null_stream_initializer(*[](std::stringstream& null_stream){
null_stream.setstate(std::ios::badbit);
return &null_stream;}(null_stream));
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
#include <PastisMacros.hpp> #include <PastisMacros.hpp>
#include <iostream> #include <iostream>
#include <sstream>
extern std::stringstream null_stream;
class PastisOStream class PastisOStream
{ {
...@@ -37,5 +40,6 @@ class PastisOStream ...@@ -37,5 +40,6 @@ class PastisOStream
extern PastisOStream pout; extern PastisOStream pout;
extern PastisOStream perr; extern PastisOStream perr;
extern const PastisOStream _null_stream_initializer;
#endif // PASTIS_OSTREAM_HPP #endif // PASTIS_OSTREAM_HPP
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment