exception.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2019, CNRS
3  * Copyright 2018-2019, INRIA
4  */
5 
6 #ifndef __eigenpy_exception_hpp__
7 #define __eigenpy_exception_hpp__
8 
9 #include <exception>
10 #include <string>
11 
12 #include "eigenpy/fwd.hpp"
13 
14 namespace eigenpy {
15 /*
16  * Eigenpy exception. They can be catch with python (equivalent
17  * eigenpy.exception class).
18  */
19 class Exception : public std::exception {
20  public:
21  Exception() : message() {}
22  Exception(const std::string &msg) : message(msg) {}
23  const char *what() const throw() { return this->getMessage().c_str(); }
24  ~Exception() throw() {}
25  virtual const std::string &getMessage() const { return message; }
26  std::string copyMessage() const { return getMessage(); }
27 
28  /* Call this static function to "enable" the translation of this C++ exception
29  * in Python. */
30  static void registerException();
31 
32  private:
33  static void translateException(Exception const &e);
34  static PyObject *pyType;
35 
36  protected:
37  std::string message;
38 };
39 
40 } // namespace eigenpy
41 
42 #endif // ifndef __eigenpy_exception_hpp__
virtual const std::string & getMessage() const
Definition: exception.hpp:25
std::string message
Definition: exception.hpp:37
Exception(const std::string &msg)
Definition: exception.hpp:22
const char * what() const
Definition: exception.hpp:23
static void translateException(Exception const &e)
Definition: exception.cpp:15
static PyObject * pyType
Definition: exception.hpp:34
static void registerException()
Definition: exception.cpp:21
std::string copyMessage() const
Definition: exception.hpp:26


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Fri Jun 2 2023 02:10:26