Flow123d  DF_patch_fe_data_tables-92632e6
stack_trace.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file stack_trace.hh
15  * @brief
16  */
17 
18 #ifndef STACK_TRACE_HH_
19 #define STACK_TRACE_HH_
20 
21 #include <iostream>
22 #include <string>
23 #include <vector>
24 
25 
26 /**
27  * @brief Class representing stacktrace of exceptions.
28  *
29  * Store array of backtrace frames and size of this array, method @p print allows to print
30  * formated stacktrace into given stream.
31  *
32  * @ingroup exceptions
33  */
35 {
36 public:
37  /// Default constructor, fill stacktrace
38  StackTrace();
39 
40  /// Copy constructor
41  StackTrace(const StackTrace &other);
42 
43  /// Destructor
44  ~StackTrace();
45 
46  /// Prints formated stacktrace into given stream @p out.
47  void print(std::ostream &out, std::vector<std::string> frames_to_cut = std::vector<std::string>()) const;
48 
49 private:
50 
51  /// Array of backtrace frames returned by glibc backtrace_symbols.
52  char ** frames_;
53 
54  /// Size of stacktrace table - number of frames.
55  int n_frames_;
56 };
57 
58 
59 #endif /* STACK_TRACE_HH_ */
60 
Class representing stacktrace of exceptions.
Definition: stack_trace.hh:35
StackTrace()
Default constructor, fill stacktrace.
Definition: stack_trace.cc:33
int n_frames_
Size of stacktrace table - number of frames.
Definition: stack_trace.hh:55
~StackTrace()
Destructor.
Definition: stack_trace.cc:62
void print(std::ostream &out, std::vector< std::string > frames_to_cut=std::vector< std::string >()) const
Prints formated stacktrace into given stream out.
Definition: stack_trace.cc:72
char ** frames_
Array of backtrace frames returned by glibc backtrace_symbols.
Definition: stack_trace.hh:52