1.4.0
CCC
 
StdoutRedirect Class Reference

#include <File.hpp>

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.

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 ()
 

Constructor & Destructor Documentation

◆ StdoutRedirect() [1/2]

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

◆ ~StdoutRedirect()

StdoutRedirect::~StdoutRedirect ( )

◆ StdoutRedirect() [2/2]

StdoutRedirect::StdoutRedirect ( const StdoutRedirect )
delete

Member Function Documentation

◆ operator=()

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

◆ start()

void StdoutRedirect::start ( const String file)

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

Parameters
[in]fileFile path to be written

◆ stop()

void StdoutRedirect::stop ( )

Restore original stdout


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