*/
bool at_newline;
- /**
- * The flags used to modify how
- * the stream returned by get_stream() is used.
- */
- std::ios_base::fmtflags stream_flags;
-
- /**
- * The minimum width of characters
- * used to represent a number. Used by width() to
- * change the stream return by get_stream()
- */
- std::streamsize stream_width;
-
- /**
- * The maximum width of characters
- * used to represent a floating point number.
- * Used by precision() to
- * change the stream return by get_stream()
- */
- std::streamsize stream_precision;
-
/**
* Print head of line. This prints optional time information and the
* contents of the prefix stack.
LogStream &
LogStream::operator<< (const T &t)
{
- // save the state of the output stream
- std::ostringstream &stream = get_stream();
-
- // print to the internal stringstream, using the flags we have just set for
- // the stream object:
- stream << t;
+ // print to the internal stringstream
+ get_stream() << t;
return *this;
}
LogStream &
LogStream::operator<< (const double t)
{
- // save the state of out stream
std::ostringstream &stream = get_stream();
// we have to make sure that we don't catch NaN's and +-Inf's with the
LogStream &
LogStream::operator<< (const float t)
{
- // save the state of out stream
std::ostringstream &stream = get_stream();
// we have to make sure that we don't catch NaN's and +-Inf's with the
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011, 2012 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
float_threshold(0.),
offset(0),
old_cerr(0),
- at_newline(true),
- stream_flags(std::ios::showpoint | std::ios::left),
- stream_width(std::cout.width()),
- stream_precision(std::cout.precision())
+ at_newline(true)
{
get_prefixes().push("DEAL:");
{
std::ostringstream &stream = get_stream();
- // save the state of out stream
- std::ios::fmtflags old_flags = stream.flags(stream_flags);
- unsigned int old_precision = stream.precision (stream_precision);
- unsigned int old_width = stream.width (stream_width);
// Print to the internal stringstream:
stream << p;
stream.str("");
}
- // reset output format
- stream.flags (old_flags);
- stream.precision(old_precision);
- stream.width(old_width);
-
return *this;
}
std::ios::fmtflags
LogStream::flags(const std::ios::fmtflags f)
{
- Threads::Mutex::ScopedLock lock(log_lock);
-
- std::ios::fmtflags tmp = stream_flags;
- stream_flags = f;
- return tmp;
+ return get_stream().flags (f);
}
std::streamsize
LogStream::precision (const std::streamsize prec)
{
- Threads::Mutex::ScopedLock lock(log_lock);
-
- std::streamsize tmp = stream_precision;
- stream_precision = prec;
- return tmp;
+ return get_stream().precision (prec);
}
std::streamsize
LogStream::width (const std::streamsize wide)
{
- Threads::Mutex::ScopedLock lock(log_lock);
-
- std::streamsize tmp = stream_width;
- stream_width = wide;
- return tmp;
+ return get_stream().width (wide);
}