TRIQS/triqs_modest 3.3.0
Brillouin zone summation
Loading...
Searching...
No Matches
triqs::ostream_with_verbosity

#include <triqs/utility/streams.hpp>

Detailed Description

FIXME : MERGE : replace triqs::report_steam, -> merge + alias.

A stream wrapper that conditionally forwards output to an underlying std::ostream based on a verbosity level.

The stream_with_verbosity class allows selective printing to an output stream depending on a user-defined verbosity threshold.

Usage:

stream_with_verbosity out(std::cout, verbosity);
out << "This message is printed if verbosity > 0." << std::endl;
out(3) << "This will print only if verbosity >= 3." << std::endl;

Definition at line 28 of file streams.hpp.

Public Member Functions

 ostream_with_verbosity (std::ostream &out, int verbosity=1)
 Construct a stream_with_verbosity.
 
ostream_with_verbosity operator() (int n) const
 Create a derived stream with adjusted verbosity.
 
ostream_with_verbosityoperator<< (std::ostream &(*manip)(std::ostream &))
 Stream insertion for manipulators like std::endl.
 
template<typename T >
ostream_with_verbosityoperator<< (T const &value)
 Stream insertion operator for generic types.
 

Constructor & Destructor Documentation

◆ ostream_with_verbosity()

triqs::ostream_with_verbosity::ostream_with_verbosity ( std::ostream &  out,
int  verbosity = 1 
)
inline

Construct a stream_with_verbosity.

Parameters
outReference to the output stream (e.g., std::cout).
verbosityInitial verbosity level (default is 1).

Definition at line 39 of file streams.hpp.

Member Function Documentation

◆ operator()()

ostream_with_verbosity triqs::ostream_with_verbosity::operator() ( int  n) const
inline

Create a derived stream with adjusted verbosity.

Parameters
nThe minimum verbosity required for output.
Returns
A new stream_with_verbosity with reduced verbosity.

Definition at line 46 of file streams.hpp.

◆ operator<<() [1/2]

ostream_with_verbosity & triqs::ostream_with_verbosity::operator<< ( std::ostream &(*)(std::ostream &)  manip)
inline

Stream insertion for manipulators like std::endl.

Parameters
manipThe manipulator function (e.g., std::endl).
Returns
Reference to this stream_with_verbosity instance.

Definition at line 64 of file streams.hpp.

◆ operator<<() [2/2]

template<typename T >
ostream_with_verbosity & triqs::ostream_with_verbosity::operator<< ( T const &  value)
inline

Stream insertion operator for generic types.

Template Parameters
TAny type supporting operator<< with std::ostream.
Parameters
valueThe value to write to the stream.
Returns
Reference to this stream_with_verbosity instance.

Definition at line 54 of file streams.hpp.


The documentation for this class was generated from the following file: