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  /*
17  * Eigenpy exception. They can be catch with python (equivalent eigenpy.exception class).
18  */
19  class Exception : public std::exception
20  {
21  public:
22  Exception() : message() {}
23  Exception(const std::string & msg) : message(msg) {}
24  const char *what() const throw()
25  {
26  return this->getMessage().c_str();
27  }
28  ~Exception() throw() {}
29  virtual const std::string & getMessage() const { return message; }
30  std::string copyMessage() const { return getMessage(); }
31 
32  /* Call this static function to "enable" the translation of this C++ exception in Python. */
33  static void registerException();
34 
35  private:
36  static void translateException( Exception const & e );
37  static PyObject * pyType;
38  protected:
39  std::string message;
40  };
41 
42 } // namespace eigenpy
43 
44 #endif // ifndef __eigenpy_exception_hpp__
std::string message
Definition: exception.hpp:39
std::string copyMessage() const
Definition: exception.hpp:30
Exception(const std::string &msg)
Definition: exception.hpp:23
virtual const std::string & getMessage() const
Definition: exception.hpp:29
static void translateException(Exception const &e)
Definition: exception.cpp:16
static PyObject * pyType
Definition: exception.hpp:37
const char * what() const
Definition: exception.hpp:24
static void registerException()
Definition: exception.cpp:23


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Sat Apr 17 2021 02:37:59