1.2.1
CCC
 
StdoutRedirect Class Reference

#include <File.hpp>

Public Member Functions

 StdoutRedirect (const String &file="", int argc=0, char *argv[]=nullptr, int number=1)
 
 ~StdoutRedirect ()
 
 StdoutRedirect (const StdoutRedirect &)=delete
 
StdoutRedirectoperator= (const StdoutRedirect &)=delete
 
void start (const String &file)
 
void stop ()
 

Detailed Description

Redirection facility This function is used to redirect the output of the script to an auxiliary file This facility is used within the non-regression tests calling: std::stringstream sfn; sfn << gslBaseName(FILE) << ".out"; StdoutRedirect sr(sfn.str(), argc, argv); The redirection can be cancelled (with no argument modification) if the number of arguments 'argc' is larger than a given threshold By default, this threshold is set to 1 (name of executable itself) This can even be modified by adding 'number' different from 1 if some arguments are compulsory.

Constructor & Destructor Documentation

StdoutRedirect::StdoutRedirect ( const String file = "",
int  argc = 0,
char *  argv[] = nullptr,
int  number = 1 
)
StdoutRedirect::~StdoutRedirect ( )
StdoutRedirect::StdoutRedirect ( const StdoutRedirect )
delete

Member Function Documentation

StdoutRedirect& StdoutRedirect::operator= ( const StdoutRedirect )
delete
void StdoutRedirect::start ( const String file)

Save current stdout handle and redirect std::cout to a file

Parameters
[in]fileFile path to be written
void StdoutRedirect::stop ( )

Restore original stdout


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