Main MRPT website > C++ reference for MRPT 1.9.9
test.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+
9  */
10 
11 #include <mrpt/system/backtrace.h>
12 #include <iostream>
13 
14 class Foo
15 {
16  public:
17  static int func1(int a, int b)
18  {
21  std::cout << bt.asString();
22  return a + b;
23  }
24 };
25 
26 // ------------------------------------------------------
27 // MAIN
28 // ------------------------------------------------------
29 int main()
30 {
31  try
32  {
33  Foo::func1(1, 2);
34 
35  return 0;
36  }
37  catch (std::exception& e)
38  {
39  std::cout << "MRPT exception caught: " << e.what() << std::endl;
40  return -1;
41  }
42  catch (...)
43  {
44  printf("Untyped exception!!");
45  return -1;
46  }
47 }
Foo
Definition: stl_serialize_unittest.cpp:64
mrpt::system::TCallStackBackTrace::asString
std::string asString() const
Prints all backtrace entries, one per line in a human-readable format.
Definition: backtrace.cpp:123
backtrace.h
main
int main()
Definition: vision_stereo_rectify/test.cpp:78
b
GLubyte GLubyte b
Definition: glext.h:6279
mrpt::system::getCallStackBackTrace
void getCallStackBackTrace(TCallStackBackTrace &out_bt)
Returns a list of strings representing the current call stack backtrace.
Definition: backtrace.cpp:31
mrpt::system::TCallStackBackTrace
See: getCallStackBackTrace()
Definition: backtrace.h:35
Foo::func1
static int func1(int a, int b)
Definition: vision_stereo_rectify/test.cpp:17
a
GLubyte GLubyte GLubyte a
Definition: glext.h:6279



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST