Reference documentation for deal.II version 9.0.0
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
ExceptionBase Class Reference

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

Inheritance diagram for ExceptionBase:
[legend]

Public Member Functions

 ExceptionBase ()
 
 ExceptionBase (const ExceptionBase &exc)
 
virtual ~ExceptionBase () noexcept
 
ExceptionBase operator= (const ExceptionBase &)=delete
 
void set_fields (const char *file, const int line, const char *function, const char *cond, const char *exc_name)
 
virtual const char * what () const noexcept
 
const char * get_exc_name () const
 
void print_exc_data (std::ostream &out) const
 
virtual void print_info (std::ostream &out) const
 
void print_stack_trace (std::ostream &out) const
 

Protected Attributes

const char * file
 
unsigned int line
 
const char * function
 
const char * cond
 
const char * exc
 
char ** stacktrace
 
int n_stacktrace_frames
 
void * raw_stacktrace [25]
 

Private Member Functions

void generate_message () const
 

Private Attributes

std::string what_str
 

Detailed Description

This class is the base class for all exception classes. Do not use its methods and variables directly since the interface and mechanism may be subject to change. Rather create new exception classes using the DeclException macro family.

See the Exceptions and assertions module for more details on this class and what can be done with classes derived from it.

Author
Wolfgang Bangerth, 1997, 1998, Matthias Maier, 2013

Definition at line 49 of file exceptions.h.

Constructor & Destructor Documentation

◆ ExceptionBase() [1/2]

ExceptionBase::ExceptionBase ( )

Default constructor.

Definition at line 70 of file exceptions.cc.

◆ ExceptionBase() [2/2]

ExceptionBase::ExceptionBase ( const ExceptionBase exc)

Copy constructor.

Definition at line 89 of file exceptions.cc.

◆ ~ExceptionBase()

ExceptionBase::~ExceptionBase ( )
virtualnoexcept

Destructor.

Definition at line 108 of file exceptions.cc.

Member Function Documentation

◆ operator=()

ExceptionBase ExceptionBase::operator= ( const ExceptionBase )
delete

Copy operator. This operator is deleted since exception objects are not copyable.

◆ set_fields()

void ExceptionBase::set_fields ( const char *  file,
const int  line,
const char *  function,
const char *  cond,
const char *  exc_name 
)

Set the file name and line of where the exception appeared as well as the violated condition and the name of the exception as a char pointer. This function also populates the stacktrace.

Definition at line 116 of file exceptions.cc.

◆ what()

const char * ExceptionBase::what ( ) const
virtualnoexcept

Override the standard function that returns the description of the error.

Definition at line 138 of file exceptions.cc.

◆ get_exc_name()

const char * ExceptionBase::get_exc_name ( ) const

Get exception name.

Definition at line 160 of file exceptions.cc.

◆ print_exc_data()

void ExceptionBase::print_exc_data ( std::ostream &  out) const

Print out the general part of the error information.

Definition at line 167 of file exceptions.cc.

◆ print_info()

void ExceptionBase::print_info ( std::ostream &  out) const
virtual

Print more specific information about the exception which occurred. Overload this function in your own exception classes.

Reimplemented in StandardExceptions::ExcMPI, SolverControl::NoConvergence, and LACExceptions::ExcPETScError.

Definition at line 199 of file exceptions.cc.

◆ print_stack_trace()

void ExceptionBase::print_stack_trace ( std::ostream &  out) const

Print a stacktrace, if one has been recorded previously, to the given stream.

Definition at line 206 of file exceptions.cc.

◆ generate_message()

void ExceptionBase::generate_message ( ) const
private

Internal function that generates the c_string. Called by what().

Definition at line 296 of file exceptions.cc.

Member Data Documentation

◆ file

const char* ExceptionBase::file
protected

Name of the file this exception happens in.

Definition at line 116 of file exceptions.h.

◆ line

unsigned int ExceptionBase::line
protected

Line number in this file.

Definition at line 121 of file exceptions.h.

◆ function

const char* ExceptionBase::function
protected

Name of the function, pretty printed.

Definition at line 126 of file exceptions.h.

◆ cond

const char* ExceptionBase::cond
protected

The violated condition, as a string.

Definition at line 131 of file exceptions.h.

◆ exc

const char* ExceptionBase::exc
protected

Name of the exception and call sequence.

Definition at line 136 of file exceptions.h.

◆ stacktrace

char** ExceptionBase::stacktrace
mutableprotected

A backtrace to the position where the problem happened, if the system supports this.

Definition at line 142 of file exceptions.h.

◆ n_stacktrace_frames

int ExceptionBase::n_stacktrace_frames
protected

The number of stacktrace frames that are stored in the previous variable. Zero if the system does not support stack traces.

Definition at line 148 of file exceptions.h.

◆ raw_stacktrace

void* ExceptionBase::raw_stacktrace[25]
protected

array of pointers that contains the raw stack trace

Definition at line 154 of file exceptions.h.

◆ what_str

std::string ExceptionBase::what_str
mutableprivate

A pointer to the c_string that will be printed by what(). It is populated by generate_message()

Definition at line 167 of file exceptions.h.


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