#include <source/toolbox/base/ParallelBuffer.h>
Public Member Functions | |
ParallelBuffer () | |
virtual | ~ParallelBuffer () |
void | setActive (bool active) |
void | setPrefixString (const std::string &text) |
void | setOutputStream1 (std::ostream *stream) |
void | setOutputStream2 (std::ostream *stream) |
void | outputString (const std::string &text) |
void | outputString (const std::string &text, const int length) |
virtual int | sync () |
virtual int | overflow (int ch) |
SAMRAI::tbox::ParallelBuffer::ParallelBuffer | ( | ) |
Create a parallel buffer class. The object will require further initialization to set up the I/O streams and prefix string.
SAMRAI::tbox::ParallelBuffer::~ParallelBuffer | ( | ) | [virtual] |
The destructor simply deallocates any internal data buffers. It does not modify the output streams.
void SAMRAI::tbox::ParallelBuffer::setActive | ( | bool | active | ) |
Set whether the output stream will be active. If the parallel buffer stream is disabled, then no data is forwarded to the output streams. The internal data buffer is deallocated and pointers are reset whenever the parallel buffer is deactivated.
void SAMRAI::tbox::ParallelBuffer::setPrefixString | ( | const std::string & | text | ) |
Set the prefix that begins every new line to the output stream. A sample prefix is "P=XXXXX: ", where XXXXX represents the node number.
void SAMRAI::tbox::ParallelBuffer::setOutputStream1 | ( | std::ostream * | stream | ) |
Set the primary output stream. If not NULL, then output data is sent to this stream. The primary output stream is typically stderr or stdout or perhaps a log file.
void SAMRAI::tbox::ParallelBuffer::setOutputStream2 | ( | std::ostream * | stream | ) |
Set the secondary output stream. If not NULL, then output data is sent to this stream. The secondary output stream is typically NULL or a log file that mirrors the primary output stream.
void SAMRAI::tbox::ParallelBuffer::outputString | ( | const std::string & | text | ) |
Write a text string to the output stream. Note that the string is not actually written until an end-of-line is detected.
void SAMRAI::tbox::ParallelBuffer::outputString | ( | const std::string & | text, | |
const int | length | |||
) |
Write a text string of the specified length to the output file. Note that the string is not actually written until an end-of-line is detected.
int SAMRAI::tbox::ParallelBuffer::sync | ( | ) | [virtual] |
Synchronize the parallel buffer (called from streambuf).
int SAMRAI::tbox::ParallelBuffer::overflow | ( | int | ch | ) | [virtual] |
Write an overflow character into the parallel buffer (called from streambuf).