libMesh
Public Member Functions | Private Attributes | List of all members
StreamRedirector Class Reference

This class uses RAII to control redirecting the libMesh::err stream to NULL and restoring it around some operation where we do not want to see output to the screen. More...

#include <stream_redirector.h>

Public Member Functions

 StreamRedirector ()
 Constructor; saves the original libMesh::err streambuf. More...
 
 ~StreamRedirector ()
 Destructor: restores the stream. More...
 

Private Attributes

std::streambuf * _errbuf
 

Detailed Description

This class uses RAII to control redirecting the libMesh::err stream to NULL and restoring it around some operation where we do not want to see output to the screen.

Definition at line 8 of file stream_redirector.h.

Constructor & Destructor Documentation

◆ StreamRedirector()

StreamRedirector::StreamRedirector ( )
inline

Constructor; saves the original libMesh::err streambuf.

Definition at line 15 of file stream_redirector.h.

References libMesh::err, and libMesh::BasicOStreamProxy< charT, traits >::rdbuf().

16  : _errbuf(libMesh::err.rdbuf())
17  {
18  libMesh::err.rdbuf(nullptr);
19  }
OStreamProxy err
std::streambuf * _errbuf
streambufT * rdbuf() const
Get the associated stream buffer.

◆ ~StreamRedirector()

StreamRedirector::~StreamRedirector ( )
inline

Destructor: restores the stream.

Definition at line 24 of file stream_redirector.h.

References _errbuf, libMesh::err, and libMesh::BasicOStreamProxy< charT, traits >::rdbuf().

25  {
27  }
OStreamProxy err
std::streambuf * _errbuf
streambufT * rdbuf() const
Get the associated stream buffer.

Member Data Documentation

◆ _errbuf

std::streambuf* StreamRedirector::_errbuf
private

Definition at line 30 of file stream_redirector.h.

Referenced by ~StreamRedirector().


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