GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TRedirect Class Reference

Detailed Description

A simple class to redirect stdout and stderr to file(s). To use it, create it, providing the path of the files stdout and stderr should be redirected to, and an (optional) flag whether to append to those files (default) or not. If only one file is provided, both stdout and stderr are redirected to it. If the filename for either stdout or stderr is a nullptr, the redirection for this output won't happen. The redirection ends when the TRedirect object is destroyed.

Definition at line 26 of file TRedirect.h.

Public Member Functions

 TRedirect (const char *newOut, bool append=true)
 
 TRedirect (const char *newOut, const char *newErr, bool append=true)
 
 TRedirect (const TRedirect &)=delete
 
 TRedirect (TRedirect &&)=delete
 
 ~TRedirect ()
 
const char * ErrFile ()
 
TRedirectoperator= (const TRedirect &)=delete
 
TRedirectoperator= (TRedirect &&)=delete
 
const char * OutFile ()
 

Private Member Functions

void Redirect (bool append)
 

Private Attributes

const char * fErrFile {nullptr}
 
const char * fOutFile {nullptr}
 
int fStdErrFileDescriptor {0}
 
int fStdOutFileDescriptor {0}
 

Constructor & Destructor Documentation

◆ TRedirect() [1/4]

TRedirect::TRedirect ( const char * newOut,
const char * newErr,
bool append = true )
inline

Definition at line 28 of file TRedirect.h.

References Redirect().

◆ TRedirect() [2/4]

TRedirect::TRedirect ( const char * newOut,
bool append = true )
inlineexplicit

Definition at line 33 of file TRedirect.h.

References Redirect().

◆ ~TRedirect()

TRedirect::~TRedirect ( )
inline

Definition at line 42 of file TRedirect.h.

References fStdErrFileDescriptor, and fStdOutFileDescriptor.

◆ TRedirect() [3/4]

TRedirect::TRedirect ( const TRedirect & )
delete

◆ TRedirect() [4/4]

TRedirect::TRedirect ( TRedirect && )
delete

Member Function Documentation

◆ ErrFile()

const char * TRedirect::ErrFile ( )
inline

Definition at line 40 of file TRedirect.h.

References fErrFile.

Referenced by TGRSIFrame::Run().

◆ operator=() [1/2]

TRedirect & TRedirect::operator= ( const TRedirect & )
delete

◆ operator=() [2/2]

TRedirect & TRedirect::operator= ( TRedirect && )
delete

◆ OutFile()

const char * TRedirect::OutFile ( )
inline

Definition at line 39 of file TRedirect.h.

References fOutFile.

Referenced by TGRSIFrame::Run().

◆ Redirect()

void TRedirect::Redirect ( bool append)
inlineprivate

Definition at line 57 of file TRedirect.h.

References fErrFile, fOutFile, fStdErrFileDescriptor, and fStdOutFileDescriptor.

Referenced by TRedirect(), and TRedirect().

Member Data Documentation

◆ fErrFile

const char* TRedirect::fErrFile {nullptr}
private

Definition at line 78 of file TRedirect.h.

Referenced by ErrFile(), and Redirect().

◆ fOutFile

const char* TRedirect::fOutFile {nullptr}
private

Definition at line 77 of file TRedirect.h.

Referenced by OutFile(), and Redirect().

◆ fStdErrFileDescriptor

int TRedirect::fStdErrFileDescriptor {0}
private

Definition at line 76 of file TRedirect.h.

Referenced by ~TRedirect(), and Redirect().

◆ fStdOutFileDescriptor

int TRedirect::fStdOutFileDescriptor {0}
private

Definition at line 75 of file TRedirect.h.

Referenced by ~TRedirect(), and Redirect().