![]() |
OpenLB 1.8.1
|
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) | |
| OstreamManager & | operator= (const OstreamManager &rhs) |
| ~OstreamManager () override | |
| void | setMultiOutput (bool b) |
| enable message output for all MPI processes, disabled by default | |
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:
#include<olb/io>
ExampleClass {
private:
OstreamManager clout;
public:
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.
| olb::OstreamManager::OstreamManager | ( | std::string | classname | ) |
constructor that uses std::cout by default
Definition at line 110 of file ostreamManager.cpp.
| olb::OstreamManager::OstreamManager | ( | std::ostream & | str, |
| std::string | classname ) |
constructor for default usage
Definition at line 114 of file ostreamManager.cpp.
| olb::OstreamManager::OstreamManager | ( | const OstreamManager & | rhs | ) |
Definition at line 118 of file ostreamManager.cpp.
|
inlineoverride |
Definition at line 99 of file ostreamManager.h.
| OstreamManager & olb::OstreamManager::operator= | ( | const OstreamManager & | rhs | ) |
Definition at line 122 of file ostreamManager.cpp.
| void olb::OstreamManager::setMultiOutput | ( | bool | b | ) |
enable message output for all MPI processes, disabled by default
Definition at line 128 of file ostreamManager.cpp.
References olb::OMBuf::setMultiOutput().
Here is the call graph for this function:
Here is the caller graph for this function: