Main MRPT website > C++ reference for MRPT 1.3.2
exceptions.hpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2014, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #ifndef STLPLUS_EXCEPTIONS
11 #define STLPLUS_EXCEPTIONS
12 ////////////////////////////////////////////////////////////////////////////////
13 
14 // Author: Andy Rushton
15 // Copyright: (c) Andy Rushton, 2007
16 // License: BSD License, see ../docs/license.html
17 
18 // The set of general exceptions thrown by STLplus components
19 
20 ////////////////////////////////////////////////////////////////////////////////
21 #include "containers_fixes.hpp"
22 #include <stdexcept>
23 #include <string>
24 
25 namespace stlplus
26 {
27 
28  ////////////////////////////////////////////////////////////////////////////////
29  // Thrown if a pointer or an iterator is dereferenced when it is null
30 
31  class null_dereference : public std::logic_error
32  {
33  public:
34  null_dereference(const std::string& description) throw() :
35  std::logic_error(std::string("stlplus::null_dereference: ") + description) {}
36  ~null_dereference(void) throw() {}
37  };
38 
39  ////////////////////////////////////////////////////////////////////////////////
40  // Thrown if an iterator is dereferenced when it is pointing to the end element
41 
42  class end_dereference : public std::logic_error
43  {
44  public:
45  end_dereference(const std::string& description) throw() :
46  std::logic_error("stlplus::end_dereference: " + description) {}
47  ~end_dereference(void) throw() {}
48  };
49 
50  ////////////////////////////////////////////////////////////////////////////////
51  // Thrown if an iterator is used with the wrong container. In other words, an
52  // iterator is created as a pointer to a sub-object within a container. If
53  // that iterator is then used with a different container, this exception is
54  // thrown.
55 
56  class wrong_object : public std::logic_error
57  {
58  public:
59  wrong_object(const std::string& description) throw() :
60  std::logic_error("stlplus::wrong_object: " + description) {}
61  ~wrong_object(void) throw() {}
62  };
63 
64  ////////////////////////////////////////////////////////////////////////////////
65  // Thrown if an attempt is made to copy an object that is uncopyable
66 
67  class illegal_copy : public std::logic_error
68  {
69  public:
70  illegal_copy(const std::string& description) throw() :
71  std::logic_error("stlplus::illegal_copy: " + description) {}
72  ~illegal_copy(void) throw() {}
73  };
74 
75  ////////////////////////////////////////////////////////////////////////////////
76 
77 } // end namespace stlplus
78 
79 #endif
illegal_copy(const std::string &description)
Definition: exceptions.hpp:70
end_dereference(const std::string &description)
Definition: exceptions.hpp:45
null_dereference(const std::string &description)
Definition: exceptions.hpp:34
wrong_object(const std::string &description)
Definition: exceptions.hpp:59



Page generated by Doxygen 1.8.9.1 for MRPT 1.3.2 SVN:Unversioned directory at Tue Dec 8 09:49:21 UTC 2015