https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ConsoleStream.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10// Moose includes
11#include "ConsoleStream.h"
12#include "MooseUtils.h"
13#include "OutputWarehouse.h"
14
16
18 : _output_warehouse(output_warehouse), _oss(std::make_shared<std::ostringstream>())
19{
20}
21
24{
25 const std::lock_guard<std::mutex> lock(_stream_mutex);
26
27 if (manip == (std::basic_ostream<char> & (*)(std::basic_ostream<char> &)) & std::endl)
28 (*_oss) << '\n';
29 else
30 (*_oss) << manip;
31
33
34 return *this;
35}
36
37void
38ConsoleStream::unsetf(std::ios_base::fmtflags mask) const
39{
40 _oss->unsetf(mask);
41}
42
43std::streamsize
45{
46 return _oss->precision();
47}
48
49std::streamsize
50ConsoleStream::precision(std::streamsize new_precision) const
51{
52 return _oss->precision(new_precision);
53}
54
55std::ios_base::fmtflags
57{
58 return _oss->flags();
59}
60
61std::ios_base::fmtflags
62ConsoleStream::flags(std::ios_base::fmtflags new_flags) const
63{
64 return _oss->flags(new_flags);
65}
66
67unsigned long long int
CoutType &(* StandardEndLine)(CoutType &)
A helper class for re-directing output streams to Console output objects form MooseObjects.
const ConsoleStream & operator<<(const StreamType &s) const
The output stream operator.
unsigned long long int numPrinted() const
The number of times something has been printed.
static std::mutex _stream_mutex
Mutex to prevent concurrent read/writes, write/writes.
std::ios_base::fmtflags flags() const
Return the current flags.
std::streamsize precision() const
Return the current precision.
OutputWarehouse & _output_warehouse
Reference to the OutputWarhouse that contains the Console output objects.
ConsoleStream(OutputWarehouse &output_warehouse)
Constructor.
std::shared_ptr< std::ostringstream > _oss
The stream for buffering the message This stupidly has to be a shared pointer because of something in...
void unsetf(std::ios_base::fmtflags mask) const
Unset format flags.
Class for storing and utilizing output objects.
unsigned long long int numPrinted() const
The number of times something has been printed.
void mooseConsole()
Send current output buffer to Console output objects.