www.mooseframework.org
ConsoleStream.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef CONSOLESTREAM_H
16 #define CONSOLESTREAM_H
17 
18 // C++ includes
19 #include <iostream>
20 #include <sstream>
21 
22 // MOOSE includes
24 
25 // this is the type of s t d :: c o u t
26 typedef std::basic_ostream<char, std::char_traits<char>> CoutType;
27 
28 // this is the function signature of std::endl
29 typedef CoutType & (*StandardEndLine)(CoutType &);
30 
35 {
36 public:
45  ConsoleStream(OutputWarehouse & output_warehouse);
46 
54  template <typename StreamType>
55  const ConsoleStream & operator<<(const StreamType & s) const;
56 
60  const ConsoleStream & operator<<(StandardEndLine manip) const;
61 
62 private:
65 
67  std::ostringstream & _oss;
68 };
69 
70 template <typename StreamType>
71 const ConsoleStream &
72 ConsoleStream::operator<<(const StreamType & s) const
73 {
74  _oss << s;
75  return *this;
76 }
77 
78 #endif // CONSOLESTREAM_H
A helper class for re-directing output streams to Console output objects form MooseObjects.
Definition: ConsoleStream.h:34
CoutType &(* StandardEndLine)(CoutType &)
Definition: ConsoleStream.h:29
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::basic_ostream< char, std::char_traits< char > > CoutType
Definition: ConsoleStream.h:23
Class for storing and utilizing output objects.
const ConsoleStream & operator<<(const StreamType &s) const
The output stream operator.
Definition: ConsoleStream.h:72
ConsoleStream(OutputWarehouse &output_warehouse)
Constructor.
Definition: ConsoleStream.C:20