hpp-core  4.9.0
Implement basic classes for canonical path planning for kinematic chains.
projection-error.hh
Go to the documentation of this file.
1 // Copyright (c) 2015 CNRS
2 // Authors: Joseph Mirabel
3 //
4 // This file is part of hpp-core
5 // hpp-core 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 // hpp-core 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 // hpp-core If not, see
16 // <http://www.gnu.org/licenses/>.
17 
18 #ifndef HPP_CORE_PROJECTION_ERROR_HH
19 #define HPP_CORE_PROJECTION_ERROR_HH
20 
21 #include <exception>
23 
24 namespace hpp {
25  namespace core {
26  struct HPP_CORE_DLLAPI projection_error : public std::exception
27  {
28  projection_error () : msg_ () {}
29 
30  projection_error (const std::string& msg) : msg_ (msg) {}
31 
33  : std::exception (other), msg_ (other.msg_) {}
34 
35  virtual ~projection_error () _GLIBCXX_USE_NOEXCEPT {};
36 
37 #if __cplusplus >= 201103L
38  virtual const char* what () const noexcept { return msg_.c_str (); };
39 #else
40  virtual const char* what () const throw() { return msg_.c_str (); };
41 #endif
42 
43  std::string msg_;
44  };
45 
48 
50  struct HPP_CORE_DLLAPI ProjectionError :
51  public ValidationReport
52  {
53  ProjectionError (const std::string& msg = "")
54  : ValidationReport(), msg (msg)
55  {}
56 
57  virtual ~ProjectionError () {};
58 
59  virtual std::ostream& print (std::ostream& os) const
60  {
61  os << "Projection error";
62  if (!msg.empty())
63  os << " (" << msg << ')';
64  return os;
65  }
66 
67  std::string msg;
68  }; // class ProjectionError
70  } // namespace core
71 } // namespace hpp
72 
73 #endif // HPP_CORE_PROJECTION_ERROR_HH
Definition: validation-report.hh:36
virtual ~ProjectionError()
Definition: projection-error.hh:57
projection_error(const projection_error &other)
Definition: projection-error.hh:32
projection_error()
Definition: projection-error.hh:28
Definition: projection-error.hh:26
virtual const char * what() const
Definition: projection-error.hh:40
ProjectionError(const std::string &msg="")
Definition: projection-error.hh:53
projection_error(const std::string &msg)
Definition: projection-error.hh:30
Handles projection errors when evaluating a path.
Definition: projection-error.hh:50
virtual std::ostream & print(std::ostream &os) const
Write report in a stream.
Definition: projection-error.hh:59
std::string msg
Definition: projection-error.hh:67
virtual ~projection_error() _GLIBCXX_USE_NOEXCEPT
Definition: projection-error.hh:35