Reference documentation for deal.II version GIT relicensing-245-g36f19064f7 2024-03-29 07:20:02+00:00
\(\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
Public Member Functions | Private Attributes | List of all members
LogStream::Prefix Class Reference

#include <deal.II/base/logstream.h>

Public Member Functions

 Prefix (const std::string &text)
 
 Prefix (const std::string &text, LogStream &stream)
 
 ~Prefix ()
 

Private Attributes

SmartPointer< LogStream, LogStream::Prefixstream
 

Detailed Description

A subclass allowing for the safe generation and removal of prefixes.

Somewhere at the beginning of a block, create one of these objects, and it will appear as a prefix in LogStream output like deallog. At the end of the block, the prefix will automatically be removed, when this object is destroyed.

In other words, the scope of the object so created determines the lifetime of the prefix. The advantage of using such an object is that the prefix is removed whichever way you exit the scope – by continue, break, return, throw, or by simply reaching the closing brace. In all of these cases, it is not necessary to remember to pop the prefix manually using LogStream::pop(). In this, it works just like the better known std::unique_ptr and std::lock_guard classes.

Definition at line 100 of file logstream.h.

Constructor & Destructor Documentation

◆ Prefix() [1/2]

LogStream::Prefix::Prefix ( const std::string &  text)

Set a new prefix for deallog, which will be removed when the variable is destroyed.

Definition at line 40 of file logstream.cc.

◆ Prefix() [2/2]

LogStream::Prefix::Prefix ( const std::string &  text,
LogStream stream 
)

Set a new prefix for the given stream, which will be removed when the variable is destroyed.

Definition at line 48 of file logstream.cc.

◆ ~Prefix()

LogStream::Prefix::~Prefix ( )

Remove the prefix associated with this variable.

Definition at line 56 of file logstream.cc.

Member Data Documentation

◆ stream

SmartPointer<LogStream, LogStream::Prefix> LogStream::Prefix::stream
private

A pointer to the LogStream object to which the prefix is applied.

Definition at line 125 of file logstream.h.


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