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