Utility class for printing error output. More...
#include <ErrorOutput.hpp>
Public Member Functions | |
ErrorOutput (FILE *str) | |
ErrorOutput (std::ostream &str) | |
~ErrorOutput () | |
bool | have_rank () const |
Check if MPI rank has been set. More... | |
int | get_rank () const |
Get MPI rank. More... | |
void | set_rank (int rank) |
Set MPI rank. More... | |
void | use_world_rank () |
Set MPI rank to the rank of this process in MPI_COMM_WORLD, if MOAB is built with MPI and MPI_Init has been called. More... | |
void | print (const char *str) |
Output the specified string. More... | |
void | print (const std::string &str) |
Output the specified string. More... | |
void | printf (const char *fmt,...) MB_PRINTF(1) |
Output the specified printf-formatted output. More... | |
Private Member Functions | |
void | print_real (const char *buffer) |
void | print_real (const std::string &str) |
void | print_real (const char *buffer, va_list args1, va_list args2) |
void | process_line_buffer () |
Private Attributes | |
ErrorOutputStream * | outputImpl |
int | mpiRank |
std::vector< char > | lineBuffer |
Utility class for printing error output.
This class implements line-oriented output. That is, it buffers output data until a newline is encountered, at which point it sends the output to the output stream followed by an explicit flush, and optionally prefixed with the MPI rank.
\Note Any output not terminated with an newline character or followed by later output containing a newline character will not be flushed until the destructor is invoked.
Definition at line 28 of file ErrorOutput.hpp.
moab::ErrorOutput::ErrorOutput | ( | FILE * | str | ) |
str | Output stream to which to flush output |
Definition at line 62 of file ErrorOutput.cpp.
References lineBuffer.
moab::ErrorOutput::ErrorOutput | ( | std::ostream & | str | ) |
str | Output stream to which to flush output |
Definition at line 67 of file ErrorOutput.cpp.
References lineBuffer.
moab::ErrorOutput::~ErrorOutput | ( | ) |
Destructor flushes any remaining output that wasn't followed by a newline character.
Definition at line 72 of file ErrorOutput.cpp.
References lineBuffer, outputImpl, and process_line_buffer().
|
inline |
Get MPI rank.
Definition at line 53 of file ErrorOutput.hpp.
References mpiRank.
Referenced by moab::MBTraceBackErrorHandler(), and process_line_buffer().
|
inline |
Check if MPI rank has been set.
Definition at line 48 of file ErrorOutput.hpp.
References mpiRank.
Referenced by moab::MBTraceBackErrorHandler(), and process_line_buffer().
|
inline |
Output the specified string.
Definition at line 67 of file ErrorOutput.hpp.
References print_real().
Referenced by moab::MBTraceBackErrorHandler().
|
inline |
Output the specified string.
Definition at line 73 of file ErrorOutput.hpp.
References print_real().
|
private |
Definition at line 98 of file ErrorOutput.cpp.
References buffer, lineBuffer, and process_line_buffer().
|
private |
Definition at line 110 of file ErrorOutput.cpp.
References lineBuffer, process_line_buffer(), and size.
|
private |
|
inline |
Output the specified printf-formatted output.
Definition at line 98 of file ErrorOutput.hpp.
References print_real().
Referenced by moab::MBTraceBackErrorHandler().
|
private |
Definition at line 130 of file ErrorOutput.cpp.
References get_rank(), have_rank(), lineBuffer, outputImpl, and moab::ErrorOutputStream::println().
Referenced by print_real(), and ~ErrorOutput().
|
inline |
void moab::ErrorOutput::use_world_rank | ( | ) |
Set MPI rank to the rank of this process in MPI_COMM_WORLD, if MOAB is built with MPI and MPI_Init has been called.
Definition at line 87 of file ErrorOutput.cpp.
References mpiRank.
Referenced by moab::MBErrorHandler_Init().
|
private |
Definition at line 95 of file ErrorOutput.hpp.
Referenced by ErrorOutput(), print_real(), process_line_buffer(), and ~ErrorOutput().
|
private |
Definition at line 83 of file ErrorOutput.hpp.
Referenced by get_rank(), have_rank(), set_rank(), and use_world_rank().
|
private |
Definition at line 82 of file ErrorOutput.hpp.
Referenced by process_line_buffer(), and ~ErrorOutput().