PGROUTING
3.2
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
i
l
m
o
p
r
s
t
u
v
w
x
Functions
a
b
c
d
e
g
i
o
p
s
Typedefs
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
~
Variables
a
b
c
d
e
f
g
i
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Typedefs
b
c
d
e
g
i
l
o
p
s
v
Enumerations
Enumerator
Related Functions
c
d
e
i
o
p
s
Files
File List
File Members
All
_
a
b
c
d
e
f
g
i
l
m
o
p
r
s
t
u
v
Functions
_
a
c
d
e
f
g
i
o
p
r
s
t
Variables
Typedefs
Enumerations
Enumerator
Macros
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
pgr_assert.cpp
Go to the documentation of this file.
1
/*PGR-GNU*****************************************************************
2
3
FILE: pgr_assert.cpp
4
5
Copyright 2015~ Vicky Vergara <vicky_vergara@hotmail.com>
6
Copyright 2014 Stephen Woodbridge <woodbri@imaptools.com>
7
Mail: project@pgrouting.org
8
9
------
10
11
This program is free software; you can redistribute it and/or modify
12
it under the terms of the GNU General Public License as published by
13
the Free Software Foundation; either version 2 of the License, or
14
(at your option) any later version.
15
16
This program is distributed in the hope that it will be useful,
17
but WITHOUT ANY WARRANTY; without even the implied warranty of
18
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
GNU General Public License for more details.
20
21
You should have received a copy of the GNU General Public License
22
along with this program; if not, write to the Free Software
23
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
25
********************************************************************PGR-GNU*/
26
#include "
cpp_common/pgr_assert.h
"
27
28
#include <stdio.h>
29
#include <stdlib.h>
30
#include <stddef.h>
31
32
#ifdef __GLIBC__
33
#include <execinfo.h>
34
#endif
35
36
#include <string>
37
#include <exception>
38
39
40
std::string
get_backtrace
() {
41
#ifdef __GLIBC__
42
void
*trace[16];
43
int
i, trace_size = 0;
44
45
trace_size = backtrace(trace, 16);
46
char
** funcNames = backtrace_symbols(trace, trace_size);
47
48
49
std::string message =
"\n*** Execution path***\n"
;
50
for
(i = 0; i < trace_size; ++i) {
51
message +=
"[bt]"
+
static_cast<
std::string
>
(funcNames[i]) +
"\n"
;
52
}
53
54
free(funcNames);
55
return
message;
56
#else
57
return
""
;
58
#endif
59
}
60
61
std::string
get_backtrace
(
const
std::string &msg) {
62
return
std::string(
"\n"
) + msg +
"\n"
+
get_backtrace
();
63
}
64
65
66
67
const
char
*
AssertFailedException::what
()
const
throw() {
68
return
str
.c_str();
69
}
70
71
AssertFailedException::AssertFailedException
(std::string msg) :
72
str(msg) {}
73
AssertFailedException::what
virtual const char * what() const
Definition:
pgr_assert.cpp:67
AssertFailedException::str
const std::string str
Holds what() we got as message.
Definition:
pgr_assert.h:141
get_backtrace
std::string get_backtrace()
returns the execution path of the trace
Definition:
pgr_assert.cpp:40
pgr_assert.h
An assert functionality that uses C++ throw().
AssertFailedException::AssertFailedException
AssertFailedException(std::string msg)
Definition:
pgr_assert.cpp:71
src
common
pgr_assert.cpp
Generated on Tue May 25 2021 15:09:48 for PGROUTING by
1.8.17