IBAMR  IBAMR version 0.19.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SAMRAI::tbox::ParallelBuffer Class Reference

#include <tbox/ParallelBuffer.h>

Inheritance diagram for SAMRAI::tbox::ParallelBuffer:
Inheritance graph
[legend]

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 std::streamsize xsputn (const char *text, std::streamsize n)
 
virtual int overflow (int ch)
 

Private Member Functions

void copyToBuffer (const std::string &text, const int length)
 
void outputBuffer ()
 

Private Attributes

bool d_active
 
std::string d_prefix
 
std::ostream * d_ostream1
 
std::ostream * d_ostream2
 
char * d_buffer
 
int d_buffer_size
 
int d_buffer_ptr
 

Detailed Description

Class ParallelBuffer is a simple I/O stream utility that intercepts output from an ostream and redirects the output as necessary for parallel I/O. This class defines a stream buffer class for an ostream class.

Constructor & Destructor Documentation

◆ ParallelBuffer()

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.

◆ ~ParallelBuffer()

virtual SAMRAI::tbox::ParallelBuffer::~ParallelBuffer ( )
virtual

The destructor simply deallocates any internal data buffers. It does not modify the output streams.

Member Function Documentation

◆ setActive()

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.

◆ setPrefixString()

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.

◆ setOutputStream1()

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.

◆ setOutputStream2()

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.

◆ outputString() [1/2]

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.

◆ outputString() [2/2]

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.

◆ sync()

virtual int SAMRAI::tbox::ParallelBuffer::sync ( )
virtual

Synchronize the parallel buffer (called from streambuf).

◆ xsputn()

virtual std::streamsize SAMRAI::tbox::ParallelBuffer::xsputn ( const char *  text,
std::streamsize  n 
)
virtual

Write the specified number of characters into the output stream (called from streambuf).

◆ overflow()

virtual int SAMRAI::tbox::ParallelBuffer::overflow ( int  ch)
virtual

Write an overflow character into the parallel buffer (called from streambuf).

◆ copyToBuffer()

void SAMRAI::tbox::ParallelBuffer::copyToBuffer ( const std::string &  text,
const int  length 
)
private

◆ outputBuffer()

void SAMRAI::tbox::ParallelBuffer::outputBuffer ( )
private

Member Data Documentation

◆ d_active

bool SAMRAI::tbox::ParallelBuffer::d_active
private

◆ d_prefix

std::string SAMRAI::tbox::ParallelBuffer::d_prefix
private

◆ d_ostream1

std::ostream* SAMRAI::tbox::ParallelBuffer::d_ostream1
private

◆ d_ostream2

std::ostream* SAMRAI::tbox::ParallelBuffer::d_ostream2
private

◆ d_buffer

char* SAMRAI::tbox::ParallelBuffer::d_buffer
private

◆ d_buffer_size

int SAMRAI::tbox::ParallelBuffer::d_buffer_size
private

◆ d_buffer_ptr

int SAMRAI::tbox::ParallelBuffer::d_buffer_ptr
private

The documentation for this class was generated from the following file: