Scippy

SoPlex

Sequential object-oriented simPlex

spxout.h File Reference

Wrapper for different output streams and verbosity levels. More...

#include <iostream>
#include <iomanip>
#include <assert.h>
#include "spxdefines.h"

Go to the source code of this file.

Classes

class  SPxOut
 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...
 
struct  SPxOut::struct_Verbosity
 helper struct for the output operator More...
 

Namespaces

 soplex
 Everything should be within this namespace.
 

Functions

Verbosity manipulator

Manipulators are implemented in a similar way as done for setw(), setprecision(), etc. in the standard library file iomanip. For instance, the non-member function verb(v) returns a struct struct_Severity which contains only the verbosity level. Calling

SPxOut spxout;
spxout << verb( SPxOut::ERROR ) << "This is an error!" << std::endl;

passes such a struct to the output operator defined below, which extracts the verbosity level from the struct and passes it to the member function SPxOut::setVerbosity().

SPxOut::struct_Verbosity verb (const SPxOut::Verbosity &v)
 manipulator to be used in an output statement More...
 
SPxOut & operator<< (SPxOut &stream, const SPxOut::struct_Verbosity &verbosity)
 output operator with verbosity level struct More...
 

Output of standard manipulators and other types

We have to define an output operator for many kinds of numeric types here because they can all be more or less casted into each other. When using only a template type, it is not clear what the compiler makes out of it (according to lint).

#define PASS_TO_CURRENT_OSTREAM(t)
 
#define DEFINE_OUTPUT_OPERATOR(Type)
 Passes instances of type Type to the current stream. More...
 
SPxOut & operator<< (SPxOut &_spxout, std::ostream &(*manip)(std::ostream &))
 Passes standard manipulators without arguments, like std::endl or std::ios::right to the current stream. More...
 
template<typename T >
SPxOut & operator<< (SPxOut &_spxout, T t)
 Passes everything else to the current stream. In particular, this includes structs corresponding to manipulators with arguments, such as the struct _Setw for the setw() manipulator. More...
 

Detailed Description

Wrapper for different output streams and verbosity levels.

Definition in file spxout.h.

Macro Definition Documentation

#define DEFINE_OUTPUT_OPERATOR (   Type)
Value:
inline SPxOut& \
operator<< ( SPxOut& _spxout, Type t ) \
#define PASS_TO_CURRENT_OSTREAM(t)
Definition: spxout.h:232

Passes instances of type Type to the current stream.

Definition at line 237 of file spxout.h.

#define PASS_TO_CURRENT_OSTREAM (   t)
Value:
_spxout.getCurrentStream() << t; \
return _spxout;

Definition at line 232 of file spxout.h.

Referenced by soplex::operator<<().