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 319 of file cfl_utils.h.

#include <cfl_utils.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 408 of file cfl_utils.cpp.

◆ ~ConsoleOut()

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

Destructor.

Definition at line 411 of file cfl_utils.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 439 of file cfl_utils.cpp.

◆ Filename()

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

Query filename.

Definition at line 328 of file cfl_utils.h.

◆ G()

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

Acess static instance.

Definition at line 415 of file cfl_utils.cpp.

◆ Mute() [1/2]

bool faudes::ConsoleOut::Mute ( )
inline

Definition at line 333 of file cfl_utils.h.

◆ Mute() [2/2]

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

Mute.

Definition at line 332 of file cfl_utils.h.

◆ Redirect()

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

Redirect.

Definition at line 419 of file cfl_utils.cpp.

◆ ToFile()

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

Redirect to file.

Definition at line 426 of file cfl_utils.cpp.

◆ Verb() [1/2]

int faudes::ConsoleOut::Verb ( )
inline

Definition at line 336 of file cfl_utils.h.

◆ Verb() [2/2]

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

Verbosity.

Definition at line 335 of file cfl_utils.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 434 of file cfl_utils.cpp.

Member Data Documentation

◆ mFilename

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

Private record file name.

Definition at line 348 of file cfl_utils.h.

◆ mMute

bool faudes::ConsoleOut::mMute
private

Mute flag.

Definition at line 350 of file cfl_utils.h.

◆ mVerb

int faudes::ConsoleOut::mVerb
private

Definition at line 351 of file cfl_utils.h.

◆ pInstance

ConsoleOut* faudes::ConsoleOut::pInstance
private

Redirect.

Definition at line 353 of file cfl_utils.h.

◆ pStream

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

Private output stream.

Definition at line 346 of file cfl_utils.h.

◆ smpInstance

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

Private static instance.

Definition at line 355 of file cfl_utils.h.


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

libFAUDES 2.32f --- 2024.12.22 --- c++ api documentaion by doxygen