OpenLB 1.7
No Matches
Public Member Functions | List of all members
olb::OstreamManager Class Reference

class for marking output with some text More...

#include <ostreamManager.h>

+ Inheritance diagram for olb::OstreamManager:
+ Collaboration diagram for olb::OstreamManager:

Public Member Functions

 OstreamManager (std::string classname)
 constructor that uses std::cout by default
 OstreamManager (std::ostream &str, std::string classname)
 constructor for default usage
 OstreamManager (const OstreamManager &rhs)
OstreamManageroperator= (const OstreamManager &rhs)
 ~OstreamManager () override
void setMultiOutput (bool b)
 enable message output for all MPI processes, disabled by default

Detailed Description

class for marking output with some text

The principle of this class consists of writing all output first in a userdefined Buffer of type OMBuf. On a flush it spits out at first the userdefined text in squared brackets and afterwards everything from the buffer. An object of this class can be used (almost) exactly like a normal std::cout with the <<-Operator and std::endl.

How to implement in the code of a class with some output:


ExampleClass {
  OstreamManager clout;
  ExampleClass() : clout(std::cout,"ExampleClass")
  showOutput() {
    clout << "where am I?" << std::endl;

A call of the function showOutput() will show in terminal:

[ExampleClass] Where am I?

Please note, that the control character \n - in contrast to std::endl - will not force a flush of the outstream. As consequence, the new line won't be prefixed with a user specified text. Other control character might not work either (untested).

Definition at line 81 of file ostreamManager.h.

Constructor & Destructor Documentation

◆ OstreamManager() [1/3]

olb::OstreamManager::OstreamManager ( std::string classname)

constructor that uses std::cout by default

Definition at line 110 of file ostreamManager.cpp.

111 : std::ostream(&buffer), buffer(std::cout, classname)
112{ }

◆ OstreamManager() [2/3]

olb::OstreamManager::OstreamManager ( std::ostream & str,
std::string classname )

constructor for default usage

Definition at line 114 of file ostreamManager.cpp.

115 : std::ostream(&buffer), buffer(str, classname)
116{ }

◆ OstreamManager() [3/3]

olb::OstreamManager::OstreamManager ( const OstreamManager & rhs)

Definition at line 118 of file ostreamManager.cpp.

119 : std::ostream(&buffer), buffer(rhs.buffer)
120{ }

◆ ~OstreamManager()

olb::OstreamManager::~OstreamManager ( )

Definition at line 99 of file ostreamManager.h.

99{ };

Member Function Documentation

◆ operator=()

OstreamManager & olb::OstreamManager::operator= ( const OstreamManager & rhs)

Definition at line 122 of file ostreamManager.cpp.

124 buffer = rhs.buffer;
125 return *this;

◆ setMultiOutput()

void olb::OstreamManager::setMultiOutput ( bool b)

enable message output for all MPI processes, disabled by default

Definition at line 128 of file ostreamManager.cpp.

130 buffer.setMultiOutput(b);
void setMultiOutput(bool b)

References olb::OMBuf::setMultiOutput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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