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.
More...
#include <capd/auxil/OutputStream.h>
|
struct | mute |
| Local mute of the stream. This class defines an object which makes the stream mute by suppressing output to both the screen and the log file and restores its setting when the object is destroyed. More...
|
|
|
| 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, bool erase=true) |
| Turns on logging to a file. If the file exists and erase is true, its contents is ereased. More...
|
|
void | logfile (const std::string &filename, bool erase=true) |
| Turns on logging to a file. If the file exists and erase is true, its contents is ereased. 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. Returns 0 if no such stream is bound with this output stream. More...
|
|
void | keepforever (void) |
| 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. More...
|
|
|
bool | 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. 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 flashed after every write operation. Note that this may slow down the output significantly if the log file is located on a network drive. More...
|
|
std::ostream & | out |
| A reference to the main output stream bound with this stream. More...
|
|
|
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.
◆ OutputStream()
capd::auxil::OutputStream::OutputStream |
( |
std::ostream & |
_out = std::cout , |
|
|
bool |
_show = true , |
|
|
bool |
_flush = false |
|
) |
| |
|
inline |
◆ ~OutputStream()
capd::auxil::OutputStream::~OutputStream |
( |
| ) |
|
|
inline |
◆ getlogstream()
std::ofstream * capd::auxil::OutputStream::getlogstream |
( |
void |
| ) |
|
|
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.
◆ keepforever()
void capd::auxil::OutputStream::keepforever |
( |
void |
| ) |
|
|
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.
◆ logfile() [1/3]
void capd::auxil::OutputStream::logfile |
( |
const char * |
filename, |
|
|
bool |
erase = true |
|
) |
| |
|
inline |
Turns on logging to a file. If the file exists and erase is true, its contents is ereased.
◆ logfile() [2/3]
void capd::auxil::OutputStream::logfile |
( |
const OutputStream & |
other | ) |
|
|
inline |
Turns on logging to the same file as some other stream.
◆ logfile() [3/3]
void capd::auxil::OutputStream::logfile |
( |
const std::string & |
filename, |
|
|
bool |
erase = true |
|
) |
| |
|
inline |
Turns on logging to a file. If the file exists and erase is true, its contents is ereased.
◆ copied
bool capd::auxil::OutputStream::copied |
|
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.
◆ flush
bool capd::auxil::OutputStream::flush |
If this variable is set to true then both the output stream 'cout' and the log file are flashed after every write operation. Note that this may slow down the output significantly if the log file is located on a network drive.
◆ log
bool capd::auxil::OutputStream::log |
If this variable is set to true then everything that is written to this stream is also written to the log file.
◆ logstream
std::ofstream* capd::auxil::OutputStream::logstream |
|
protected |
A pointer to the log file stream.
◆ out
std::ostream& capd::auxil::OutputStream::out |
A reference to the main output stream bound with this stream.
◆ show
bool capd::auxil::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.
The documentation for this class was generated from the following file: