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__
eigenpy::Exception::Exception
Exception()
Definition: exception.hpp:21
eigenpy::Exception::Exception
Exception(const std::string &msg)
Definition: exception.hpp:22
fwd.hpp
eigenpy::Exception::registerException
static void registerException()
Definition: exception.cpp:21
eigenpy::Exception::~Exception
~Exception()
Definition: exception.hpp:24
eigenpy::Exception::what
const char * what() const
Definition: exception.hpp:23
eigenpy
Definition: alignment.hpp:14
eigenpy::Exception::copyMessage
std::string copyMessage() const
Definition: exception.hpp:26
eigenpy::Exception::translateException
static void translateException(Exception const &e)
Definition: exception.cpp:15
eigenpy::Exception::message
std::string message
Definition: exception.hpp:37
eigenpy::Exception
Definition: exception.hpp:19
eigenpy::Exception::getMessage
virtual const std::string & getMessage() const
Definition: exception.hpp:25
eigenpy::Exception::pyType
static PyObject * pyType
Definition: exception.hpp:34


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Tue Jan 23 2024 03:15:01