Reference documentation for deal.II version 8.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Private Attributes | List of all members
LogStream::Prefix Class Reference

#include <logstream.h>

Public Member Functions

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

Private Attributes

SmartPointer< LogStream,
LogStream::Prefix
stream
 

Detailed Description

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

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 Threads::Mutex::ScopedLock class.

Definition at line 137 of file logstream.h.

Constructor & Destructor Documentation

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

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

Definition at line 671 of file logstream.h.

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

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

Definition at line 647 of file logstream.h.

LogStream::Prefix::~Prefix ( )
inline

Remove the prefix associated with this variable.

Definition at line 656 of file logstream.h.


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