Detailed Description

Console Out.

All console out messages (errors, progress report etc) are meant to use the global ConsoleOut instance gConsoleOut, presumably using the convenience macro FAUDES_WRITE_CONSOLE(). The default ConsoleOut::G() provides optional redirection to a named file by G()->ConsoleOut.ToFile("filename"). libFAUDES itself does not set/respect verbosity levels for its diagnostic output, this feature is implemented to support console applications.

The main motivation of the entire construct is to support gui applications that may grab all console output by 1) deriving a specialised class from ConsoleOut and 2) redirection by ConsoleOut::G()->Redirect(derived_class_instance).

Definition at line 324 of file cfl_helper.h.

#include <cfl_helper.h>

Public Member Functions

virtual void Write (const std::string &message, long int cntnow=0, long int cntdone=0, int verb=0)
 Write a std::string message (optional progress report and verbosity) More...
 
void ToFile (const std::string &filename)
 Redirect to file. More...
 
const std::string & Filename (void)
 Query filename. More...
 
void Redirect (ConsoleOut *out)
 Redirect. More...
 
void Mute (bool on)
 Mute. More...
 
bool Mute ()
 
void Verb (int verb)
 Verbosity. More...
 
int Verb ()
 

Static Public Member Functions

static ConsoleOutG (void)
 Acess static instance. More...
 

Protected Member Functions

 ConsoleOut (void)
 Constructor. More...
 
virtual ~ConsoleOut (void)
 Destructor. More...
 
virtual void DoWrite (const std::string &message, long int cntnow=0, long int cntdone=0, int verb=0)
 Writing hook. More...
 

Private Attributes

std::ofstream * pStream
 Private output stream. More...
 
std::string mFilename
 Private record file name. More...
 
bool mMute
 Mute flag. More...
 
int mVerb
 
ConsoleOutpInstance
 Redirect. More...
 

Static Private Attributes

static ConsoleOutsmpInstance =NULL
 Private static instance. More...
 

Constructor & Destructor Documentation

◆ ConsoleOut()

faudes::ConsoleOut::ConsoleOut ( void  )
protected

Constructor.

Definition at line 396 of file cfl_helper.cpp.

◆ ~ConsoleOut()

faudes::ConsoleOut::~ConsoleOut ( void  )
protectedvirtual

Destructor.

Definition at line 399 of file cfl_helper.cpp.

Member Function Documentation

◆ DoWrite()

void faudes::ConsoleOut::DoWrite ( const std::string &  message,
long int  cntnow = 0,
long int  cntdone = 0,
int  verb = 0 
)
protectedvirtual

Writing hook.

Re-implement this function in order to grab all output

Definition at line 427 of file cfl_helper.cpp.

◆ Filename()

const std::string& faudes::ConsoleOut::Filename ( void  )
inline

Query filename.

Definition at line 333 of file cfl_helper.h.

◆ G()

ConsoleOut * faudes::ConsoleOut::G ( void  )
static

Acess static instance.

Definition at line 403 of file cfl_helper.cpp.

◆ Mute() [1/2]

bool faudes::ConsoleOut::Mute ( )
inline

Definition at line 338 of file cfl_helper.h.

◆ Mute() [2/2]

void faudes::ConsoleOut::Mute ( bool  on)
inline

Mute.

Definition at line 337 of file cfl_helper.h.

◆ Redirect()

void faudes::ConsoleOut::Redirect ( ConsoleOut out)

Redirect.

Definition at line 407 of file cfl_helper.cpp.

◆ ToFile()

void faudes::ConsoleOut::ToFile ( const std::string &  filename)

Redirect to file.

Definition at line 414 of file cfl_helper.cpp.

◆ Verb() [1/2]

int faudes::ConsoleOut::Verb ( )
inline

Definition at line 341 of file cfl_helper.h.

◆ Verb() [2/2]

void faudes::ConsoleOut::Verb ( int  verb)
inline

Verbosity.

Definition at line 340 of file cfl_helper.h.

◆ Write()

void faudes::ConsoleOut::Write ( const std::string &  message,
long int  cntnow = 0,
long int  cntdone = 0,
int  verb = 0 
)
virtual

Write a std::string message (optional progress report and verbosity)

Definition at line 422 of file cfl_helper.cpp.

Member Data Documentation

◆ mFilename

std::string faudes::ConsoleOut::mFilename
private

Private record file name.

Definition at line 353 of file cfl_helper.h.

◆ mMute

bool faudes::ConsoleOut::mMute
private

Mute flag.

Definition at line 355 of file cfl_helper.h.

◆ mVerb

int faudes::ConsoleOut::mVerb
private

Definition at line 356 of file cfl_helper.h.

◆ pInstance

ConsoleOut* faudes::ConsoleOut::pInstance
private

Redirect.

Definition at line 358 of file cfl_helper.h.

◆ pStream

std::ofstream* faudes::ConsoleOut::pStream
private

Private output stream.

Definition at line 351 of file cfl_helper.h.

◆ smpInstance

ConsoleOut * faudes::ConsoleOut::smpInstance =NULL
staticprivate

Private static instance.

Definition at line 360 of file cfl_helper.h.


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

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen