deal.II version 9.7.1
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
conditional_ostream.h File Reference
#include <deal.II/base/config.h>
#include <ostream>

Go to the source code of this file.

Functions

 ConditionalOStream (std::ostream &stream, const bool active=true)
void set_condition (const bool active)
bool is_active () const
std::ostream & get_stream () const
template<typename T>
const ConditionalOStreamoperator<< (const T &t) const
const ConditionalOStreamoperator<< (std::ostream &(*p)(std::ostream &)) const

Variables

std::ostream & output_stream
bool active_flag

Function Documentation

◆ set_condition()

void ConditionalOStream::set_condition ( const bool active)

Depending on the active flag set the condition of this stream to active (true) or non-active (false). An object of this class prints to cout if and only if its condition is active.

Definition at line 30 of file conditional_ostream.cc.

◆ is_active()

bool is_active ( ) const

Return the condition of the object.

◆ get_stream()

std::ostream & get_stream ( ) const

Return a reference to the stream currently in use.

◆ operator<<() [1/2]

template<typename T>
const ConditionalOStream & operator<< ( const T & t) const

Output a constant something through this stream. This function must be const so that member objects of this type can also be used from const member functions of the surrounding class.

◆ operator<<() [2/2]

const ConditionalOStream & operator<< ( std::ostream &(* )(std::ostream &)) const

Treat ostream manipulators. This function must be const so that member objects of this type can also be used from const member functions of the surrounding class.

Note that compilers want to see this treated differently from the general template above since functions like std::endl are actually overloaded and can't be bound directly to a template type.

Variable Documentation

◆ output_stream

std::ostream& output_stream
private

Reference to the stream we want to write to.

Definition at line 134 of file conditional_ostream.h.

◆ active_flag

bool active_flag
private

Stores the actual condition the object is in.

Definition at line 139 of file conditional_ostream.h.