Line data Source code
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 : 15 : std::mutex ConsoleStream::_stream_mutex; 16 : 17 5769940 : ConsoleStream::ConsoleStream(OutputWarehouse & output_warehouse) 18 5769940 : : _output_warehouse(output_warehouse), _oss(std::make_shared<std::ostringstream>()) 19 : { 20 5769940 : } 21 : 22 : const ConsoleStream & 23 5478920 : ConsoleStream::operator<<(const StandardEndLine & manip) const 24 : { 25 5478920 : const std::lock_guard<std::mutex> lock(_stream_mutex); 26 : 27 5478920 : if (manip == (std::basic_ostream<char> & (*)(std::basic_ostream<char> &)) & std::endl) 28 1089947 : (*_oss) << '\n'; 29 : else 30 4388973 : (*_oss) << manip; 31 : 32 5478920 : _output_warehouse.mooseConsole(*_oss); 33 : 34 5478920 : return *this; 35 5478920 : } 36 : 37 : void 38 279 : ConsoleStream::unsetf(std::ios_base::fmtflags mask) const 39 : { 40 279 : _oss->unsetf(mask); 41 279 : } 42 : 43 : std::streamsize 44 8115736 : ConsoleStream::precision() const 45 : { 46 8115736 : return _oss->precision(); 47 : } 48 : 49 : std::streamsize 50 8103459 : ConsoleStream::precision(std::streamsize new_precision) const 51 : { 52 8103459 : return _oss->precision(new_precision); 53 : } 54 : 55 : std::ios_base::fmtflags 56 8115758 : ConsoleStream::flags() const 57 : { 58 8115758 : return _oss->flags(); 59 : } 60 : 61 : std::ios_base::fmtflags 62 8103202 : ConsoleStream::flags(std::ios_base::fmtflags new_flags) const 63 : { 64 8103202 : return _oss->flags(new_flags); 65 : } 66 : 67 : unsigned long long int 68 126822666 : ConsoleStream::numPrinted() const 69 : { 70 126822666 : return _output_warehouse.numPrinted(); 71 : }