Wrapper for several output streams. A verbosity level is used to decide which stream to use and whether to really print a given message. Regardless of whether the verbosity level is set via a manipulator or via the member function, it is persistent until a new value is set. More...
#include <spxout.h>
Classes | |
struct | struct_Verbosity |
helper struct for the output operator More... | |
Public Types | |
Output control types | |
enum | Verbosity { ERROR = 0, WARNING = 1, DEBUG = 2, INFO1 = 3, INFO2 = 4, INFO3 = 5 } |
Verbosity level. More... | |
Public Member Functions | |
Construction / destruction | |
SPxOut () | |
constructor More... | |
virtual | ~SPxOut () |
destructor More... | |
SPxOut (const SPxOut &) | |
copy constructor More... | |
SPxOut & | operator= (const SPxOut &) |
assignment operator More... | |
Verbosity | |
virtual void | setVerbosity (const Verbosity &v) |
Verbosity | getVerbosity () const |
Wrappers for the current stream | |
bool | good () const |
bool | operator! () const |
std::streamsize | precision () const |
Private Attributes | |
Private data | |
Verbosity | m_verbosity |
verbosity level More... | |
std::ostream ** | m_streams |
array of pointers to internal streams, indexed by verbosity level More... | |
Getting / setting streams | |
virtual void | setStream (const Verbosity &verbosity, std::ostream &stream) |
Sets the stream for the specified verbosity level. More... | |
std::ostream & | getStream (const Verbosity &verbosity) const |
Returns the stream for the specified verbosity level. More... | |
std::ostream & | getCurrentStream () const |
Returns the stream for the current verbosity. More... | |
static void | setScientific (std::ostream &stream, int precision=8) |
Sets the precision of the stream to 16 and the floatfield to scientifix. More... | |
static void | setFixed (std::ostream &stream, int precision=8) |
Sets the precision of the stream to 8 and the floatfield to fixed. More... | |
Wrapper for several output streams. A verbosity level is used to decide which stream to use and whether to really print a given message. Regardless of whether the verbosity level is set via a manipulator or via the member function, it is persistent until a new value is set.
Most ostream member functions are not provided here; use the corresponding stream manipulators (e.g., setprecision()
) instead. These are passed on to the current ostream, which is chosen according to the verbosity level. In particular, this means that the first element in an output stream should always be the verbosity. For instance, use
or
instead of
in order to make sure that std::setw( 15 )
is applied to the warning stream.
enum Verbosity |
SPxOut | ( | ) |
constructor
Definition at line 23 of file spxout.cpp.
References SPxOut::DEBUG, SPxOut::ERROR, SPxOut::INFO3, SPxOut::m_streams, soplex::spx_alloc(), and SPxOut::WARNING.
|
virtual |
destructor
Definition at line 38 of file spxout.cpp.
References SPxOut::m_streams, and soplex::spx_free().
copy constructor
Definition at line 53 of file spxout.cpp.
References SPxOut::DEBUG, SPxOut::ERROR, SPxOut::INFO3, SPxOut::m_streams, SPxOut::m_verbosity, soplex::spx_alloc(), and SPxOut::WARNING.
std::ostream& getCurrentStream | ( | ) | const |
Returns the stream for the current verbosity.
Definition at line 164 of file spxout.h.
References SPxOut::getStream(), and SPxOut::getVerbosity().
Referenced by SPxOut::good(), SPxOut::operator!(), SPxOut::precision(), SoPlex::printUserSettings(), and SPxSolver::solve().
std::ostream& getStream | ( | const Verbosity & | verbosity | ) | const |
Returns the stream for the specified verbosity level.
Definition at line 157 of file spxout.h.
References SPxOut::m_streams.
Referenced by SPxOut::getCurrentStream(), main(), SoPlex::optimize(), and Validation::validateSolveReal().
Verbosity getVerbosity | ( | ) | const |
Definition at line 117 of file spxout.h.
References SPxOut::m_verbosity.
Referenced by SoPlex::_solveDecompositionDualSimplex(), SPxOut::getCurrentStream(), and SoPlex::printDecompDisplayLine().
bool good | ( | ) | const |
Definition at line 129 of file spxout.h.
References SPxOut::getCurrentStream().
bool operator! | ( | ) | const |
Definition at line 134 of file spxout.h.
References SPxOut::getCurrentStream().
assignment operator
Definition at line 43 of file spxout.cpp.
References SPxOut::DEBUG, SPxOut::INFO3, SPxOut::m_streams, and SPxOut::m_verbosity.
std::streamsize precision | ( | ) | const |
Definition at line 139 of file spxout.h.
References SPxOut::getCurrentStream().
Referenced by SPxSolver::computeCoTest(), SPxSolver::computeFtest(), SPxSolver::computeTest(), main(), SPxOut::setFixed(), and SPxOut::setScientific().
|
static |
Sets the precision of the stream to 8 and the floatfield to fixed.
Definition at line 177 of file spxout.h.
References SPxOut::precision().
Referenced by SoPlex::Statistics::print(), SPxLPBase< Real >::printProblemStatistics(), SoPlex::printShortStatistics(), SoPlex::printStatistics(), SoPlex::printUserSettings(), and SoPlex::saveSettingsFile().
|
static |
Sets the precision of the stream to 16 and the floatfield to scientifix.
Definition at line 171 of file spxout.h.
References SPxOut::precision().
Referenced by SoPlex::Statistics::print(), SoPlex::printShortStatistics(), SoPlex::printSolutionStatistics(), SoPlex::printUserSettings(), SoPlex::saveSettingsFile(), and SPxSolver::solve().
|
virtual |
Sets the stream for the specified verbosity level.
Definition at line 150 of file spxout.h.
References SPxOut::m_streams.
|
virtual |
Definition at line 111 of file spxout.h.
References SPxOut::m_verbosity.
Referenced by SoPlex::_solveDecompositionDualSimplex(), soplex::operator<<(), SoPlex::printDecompDisplayLine(), and SoPlex::setIntParam().
|
private |
array of pointers to internal streams, indexed by verbosity level
Definition at line 191 of file spxout.h.
Referenced by SPxOut::getStream(), SPxOut::operator=(), SPxOut::setStream(), SPxOut::SPxOut(), and SPxOut::~SPxOut().
|
private |
verbosity level
Definition at line 189 of file spxout.h.
Referenced by SPxOut::getVerbosity(), SPxOut::operator=(), SPxOut::setVerbosity(), and SPxOut::SPxOut().