pinocchio  UNKNOWN
exception.hpp
1 //
2 // Copyright (c) 2015 CNRS
3 //
4 // This file is part of Pinocchio
5 // Pinocchio is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // Pinocchio is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // Pinocchio If not, see
16 // <http://www.gnu.org/licenses/>.
17 
18 #ifndef __se3_exception_hpp__
19 #define __se3_exception_hpp__
20 
21 #include <exception>
22 #include <string>
23 
24 namespace se3
25 {
26  class Exception : public std::exception
27  {
28  public:
29  Exception() : message() {}
30  Exception(std::string msg) : message(msg) {}
31  const char *what() const throw()
32  {
33  return this->getMessage().c_str();
34  }
35  ~Exception() throw() {}
36  virtual const std::string & getMessage() const { return message; }
37  std::string copyMessage() const { return getMessage(); }
38 
39  protected:
40  std::string message;
41  };
42 
43 } // namespace
44 
45 #endif // ifndef __se3_exception_hpp__