The Original CHomP Software
|
This class defines an output stream for replacing the standard 'cout'. More...
#include <textfile.h>
Classes | |
struct | mute |
Local mute of the stream. More... | |
Public Member Functions | |
outputstream (std::ostream &_out=std::cout, bool _show=true, bool _flush=false) | |
The default constructor. More... | |
~outputstream () | |
The destructor. More... | |
void | logfile (const char *filename) |
Turns on logging to a file. More... | |
void | logfile (const outputstream &other) |
Turns on logging to the same file as some other stream. More... | |
std::ofstream * | getlogstream (void) |
Returns a pointer to the stream which is working as a log file. More... | |
void | keepforever (void) |
Makes this stream keep the allocated file open for ever, and not close it even in the destructor. More... | |
int | precision () const |
Returns the precision of the main output stream. More... | |
Public Attributes | |
bool | show |
If this variable is set to true then everything that is written to this stream is also written to 'cout'. More... | |
bool | log |
If this variable is set to true then everything that is written to this stream is also written to the log file. More... | |
bool | flush |
If this variable is set to true then both the output stream 'cout' and the log file are flushed after every write operation. More... | |
std::ostream & | out |
A reference to the main output stream bound with this stream. More... | |
Protected Attributes | |
std::ofstream * | logstream |
A pointer to the log file stream. More... | |
bool | copied |
This variable is set to true if this log file pointer was copied from another output stream, and therefore it should not be deleted by this stream. More... | |
This class defines an output stream for replacing the standard 'cout'.
It has the additional features of flushing the output after every operation, suppressing the output, or logging the output to a file.
Definition at line 63 of file textfile.h.
|
inline |
The default constructor.
Definition at line 140 of file textfile.h.
|
inline |
|
inline |
Returns a pointer to the stream which is working as a log file.
Returns 0 if no such stream is bound with this output stream.
Definition at line 208 of file textfile.h.
References logstream.
|
inline |
Makes this stream keep the allocated file open for ever, and not close it even in the destructor.
It is assumed then that the file will be closed automatically by the operating system.
Definition at line 213 of file textfile.h.
References copied.
|
inline |
Turns on logging to a file.
If the file exists, its contents is ereased.
Definition at line 151 of file textfile.h.
|
inline |
Turns on logging to the same file as some other stream.
Definition at line 188 of file textfile.h.
|
inline |
Returns the precision of the main output stream.
Definition at line 219 of file textfile.h.
References out, and precision().
Referenced by precision().
|
protected |
This variable is set to true if this log file pointer was copied from another output stream, and therefore it should not be deleted by this stream.
Definition at line 134 of file textfile.h.
Referenced by keepforever(), logfile(), outputstream(), and ~outputstream().
bool chomp::homology::outputstream::flush |
If this variable is set to true then both the output stream 'cout' and the log file are flushed after every write operation.
Note that this may slow down the output significantly if the log file is located on a network drive.
Definition at line 94 of file textfile.h.
Referenced by outputstream().
bool chomp::homology::outputstream::log |
If this variable is set to true then everything that is written to this stream is also written to the log file.
Definition at line 88 of file textfile.h.
Referenced by logfile(), and outputstream().
|
protected |
A pointer to the log file stream.
Definition at line 129 of file textfile.h.
Referenced by getlogstream(), logfile(), outputstream(), and ~outputstream().
std::ostream& chomp::homology::outputstream::out |
A reference to the main output stream bound with this stream.
Definition at line 101 of file textfile.h.
Referenced by logfile(), and precision().
bool chomp::homology::outputstream::show |
If this variable is set to true then everything that is written to this stream is also written to 'cout'.
If this variable is set to false then the screen output is suppressed, while logging can still be turned on.
Definition at line 84 of file textfile.h.
Referenced by outputstream().