|
DGtal 2.0.0
|
implementation of basic methods to trace out messages with indentation levels. More...
#include <DGtal/base/Trace.h>
Public Member Functions | |
| Trace (TraceWriter &writer) | |
| ~Trace () | |
| void | reset () |
| void | beginBlock (const std::string &keyword="") |
| double | endBlock () |
| std::ostream & | info () |
| std::ostream & | warning () |
| std::ostream & | error () |
| std::ostream & | emphase () |
| void | progressBar (const double currentValue, const double maximalValue) |
| void | selfDisplay (std::ostream &out) const |
| bool | isValid () const |
Private Member Functions | |
| Trace (const Trace &other) | |
| Trace & | operator= (const Trace &other) |
Private Attributes | |
| unsigned int | myCurrentLevel |
| The indentation level. | |
| std::string | myCurrentPrefix |
| The indentation prefix string. | |
| std::stack< std::string > | myKeywordStack |
| A stack to store the block keywords. | |
| TraceWriter & | myWriter |
| A reference to the output writer. | |
| std::stack< Clock * > | myClockStack |
| A stack to store the block clocks. | |
| int | myProgressBarCurrent |
| Progress bar current position. | |
| unsigned int | myProgressBarRotation |
| Progress bar rotation position. | |
| bool | myStyle |
| True if the style has changed. | |
implementation of basic methods to trace out messages with indentation levels.
Description of class 'Trace'
Aim:
Trace objects use a TraceWriter to switch between terminal and file outputs. Methods postfixed with "Debug" contain no code if the compilation flag DEBUG is not set.
For usage examples, see the testtrace.cpp file.
| DGtal::Trace::Trace | ( | TraceWriter & | writer | ) |
Constructor.
| writer | the output writer that will receive the traces. |
Referenced by operator=(), and Trace().
| DGtal::Trace::~Trace | ( | ) |
Destructor.
|
private |
| void DGtal::Trace::beginBlock | ( | const std::string & | keyword = "" | ) |
Enter a new block and increase the indentation level
| keyword | contains a label to the new block |
Referenced by testFileStream().
| std::ostream & DGtal::Trace::emphase | ( | ) |
Create a string with an indentation prefix for an emphased trace.
Referenced by testFileStream().
| double DGtal::Trace::endBlock | ( | ) |
Leave a current block, decrease the indentation level and display the associate keyword
Referenced by testFileStream().
| std::ostream & DGtal::Trace::error | ( | ) |
Create a string with an indentation prefix for an error trace. the string is postfixed by the keyword "[ERR]"
Referenced by testFileStream().
| std::ostream & DGtal::Trace::info | ( | ) |
Create a string with an indentation prefix for a normal trace.
Referenced by testFileStream().
| bool DGtal::Trace::isValid | ( | ) | const |
Checks the validity/consistency of the object.
Assignment.
| other | the object to copy. |
References Trace().
| void DGtal::Trace::progressBar | ( | const double | currentValue, |
| const double | maximalValue ) |
Display a progress bar in the terminal.
| currentValue | current step of the progress bar |
| maximalValue | expected maximal value (must be >0) |
| void DGtal::Trace::reset | ( | ) |
Reset all the variables of the Trace object (indentation level and keyword stack)
| void DGtal::Trace::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
| out | the output stream where the object is written. |
| std::ostream & DGtal::Trace::warning | ( | ) |
Create a string with an indentation prefix for a warning trace. the string is postfixed by the keyword "[WRNG]"
Referenced by testFileStream().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |