Dakota  Version 6.15
Explore and Predict with Confidence
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
ConsoleRedirector Class Reference

Public Member Functions

 ConsoleRedirector (std::ostream *&dakota_stream, std::ostream *default_dest)
 Constructor taking a reference to the Dakota Cout/Cerr handle and a default destination to use when no redirection (or destruct)
 ~ConsoleRedirector ()
 when the redirector stack is destroyed, it will rebind the output handle to the default ostream, then destroy open files
void push_back ()
 push back the default or repeat the last pushed file stream
void push_back (const String &filename)
 push back a new output filestream, or repeat the last one if no filename change
void pop_back ()
 pop the last redirection

Protected Attributes

std::ostream *& ostreamHandle
 The handle (target ostream) through which output is sent; typically dakota_cout or dakota_cerr. Will be rebound to specific streams as they are pushed or popped.
std::ostream * defaultOStream
 initial stream to reset to when redirections are done (typically std::cout or std::cerr)
std::vector< std::shared_ptr
< OutputWriter > > 
 stack of redirections to OutputWriters; shared pointers are used to potentially share the same ostream at multiple levels

Private Member Functions

 ConsoleRedirector ()
 default constructor is disallowed
 ConsoleRedirector (const ConsoleRedirector &)
 copy constructor is disallowed due
const ConsoleRedirectoroperator= (const ConsoleRedirector &)
 assignment is disallowed

Detailed Description

Component to manage a set of output or error redirections. Push operations may present a new filename, or none in order to preserve current binding to cout/cerr or file, but place an entry on the stack. Cout/Cerr are rebound as needed when a stream is destroyed on pop.

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