![]() |
Belle II Software
release-05-02-19
|
Class to intercept stdout and stderr and either capture, discard or keep them unmodified depending on the template arguments. More...
#include <IOIntercept.h>
Public Member Functions | |
bool | start () |
Start intercepting the output. More... | |
bool | finish () |
Finish intercepting the output. More... | |
const std::string & | getStdOut () const |
Return the captured stdout output if any. More... | |
const std::string & | getStdErr () const |
Return the captured stderr output if any. More... | |
Private Attributes | |
STDOUT | m_stdout {std::cout, stdout} |
StreamInterceptor for stdout. | |
STDERR | m_stderr {std::cerr, stderr} |
StreamInterceptor for stderr. | |
Class to intercept stdout and stderr and either capture, discard or keep them unmodified depending on the template arguments.
For example
Shorthand classes are defined for all use cases, so in the above example we could have just used IOIntercept::CaptureStdOutDiscardStdErr;
Definition at line 161 of file IOIntercept.h.
|
inline |
Finish intercepting the output.
This function can be called multiple times.
Definition at line 168 of file IOIntercept.h.
|
inline |
Return the captured stderr output if any.
Only filled after finish() is called
Definition at line 176 of file IOIntercept.h.
|
inline |
Return the captured stdout output if any.
Only filled after finish() is called
Definition at line 170 of file IOIntercept.h.
|
inline |
Start intercepting the output.
This function can be called multiple times.
Definition at line 165 of file IOIntercept.h.