www.mooseframework.org
Public Member Functions | Private Attributes | List of all members
ConsoleStream Class Reference

A helper class for re-directing output streams to Console output objects form MooseObjects. More...

#include <ConsoleStream.h>

Public Member Functions

 ConsoleStream (OutputWarehouse &output_warehouse)
 Constructor. More...
 
template<typename StreamType >
const ConsoleStreamoperator<< (const StreamType &s) const
 The output stream operator. More...
 
const ConsoleStreamoperator<< (StandardEndLine manip) const
 This overload is here to handle the the std::endl manipulator. More...
 

Private Attributes

OutputWarehouse_output_warehouse
 Reference to the OutputWarhouse that contains the Console output objects. More...
 
std::ostringstream & _oss
 The stream for buffering the message. More...
 

Detailed Description

A helper class for re-directing output streams to Console output objects form MooseObjects.

Definition at line 34 of file ConsoleStream.h.

Constructor & Destructor Documentation

ConsoleStream::ConsoleStream ( OutputWarehouse output_warehouse)

Constructor.

Parameters
output_warehouseA reference to the OutputWarehouse containing the Console outputs

ConsoleStreamInterface contains an instance of this object, which allows message streams to be transferred to Console output objects. This class simply provides an operator<< method that passes the stream to the Console objects.

Definition at line 20 of file ConsoleStream.C.

21  : _output_warehouse(output_warehouse), _oss(output_warehouse.consoleBuffer())
22 {
23 }
OutputWarehouse & _output_warehouse
Reference to the OutputWarhouse that contains the Console output objects.
Definition: ConsoleStream.h:64
std::ostringstream & _oss
The stream for buffering the message.
Definition: ConsoleStream.h:67
std::ostringstream & consoleBuffer()
The buffered messages stream for Console objects.

Member Function Documentation

template<typename StreamType >
const ConsoleStream & ConsoleStream::operator<< ( const StreamType &  s) const

The output stream operator.

Parameters
sThe data to be output to the Console objects

This allows any object to uses _console to write to the Console: _console << "The combination to the air lock is " << 12345 << std::endl;

Definition at line 72 of file ConsoleStream.h.

73 {
74  _oss << s;
75  return *this;
76 }
std::ostringstream & _oss
The stream for buffering the message.
Definition: ConsoleStream.h:67
const ConsoleStream & ConsoleStream::operator<< ( StandardEndLine  manip) const

This overload is here to handle the the std::endl manipulator.

Definition at line 25 of file ConsoleStream.C.

26 {
27  _oss << '\n';
29 
30  return *this;
31 }
OutputWarehouse & _output_warehouse
Reference to the OutputWarhouse that contains the Console output objects.
Definition: ConsoleStream.h:64
std::ostringstream & _oss
The stream for buffering the message.
Definition: ConsoleStream.h:67
void mooseConsole()
Send current output buffer to Console output objects.

Member Data Documentation

std::ostringstream& ConsoleStream::_oss
private

The stream for buffering the message.

Definition at line 67 of file ConsoleStream.h.

Referenced by operator<<().

OutputWarehouse& ConsoleStream::_output_warehouse
private

Reference to the OutputWarhouse that contains the Console output objects.

Definition at line 64 of file ConsoleStream.h.

Referenced by operator<<().


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