Main MRPT website > C++ reference
MRPT logo
exceptions.hpp
Go to the documentation of this file.
1 /*
2  The STL+ C++ Library Collection
3 
4  Website <http://stlplus.sourceforge.net/> Collection <index.html>
5 
6 
7  License Agreement
8 
9  <http://www.opensource.org/>
10 
11  * License for using the STLplus Library Collection <#license>
12  * The Intent of this License <#intent>
13  * How to Comply with this License <#compliance>
14  * Historical Note <#history>
15 
16 
17  License for using the STLplus Library Collection
18 
19  *© 1999-2008 Andy Rushton. All rights reserved.*
20 
21  Redistribution and use in source and binary forms, with or without
22  modification, are permitted provided that the following conditions are met:
23 
24  * Redistributions of source code must retain the above Copyright
25  notice, this list of conditions and the following disclaimer.
26  * Redistributions in binary form must reproduce the above Copyright
27  notice, this list of conditions and the following disclaimer in
28  the documentation and/or other materials provided with the
29  distribution.
30  * Neither the name of the STLplus library nor the names of its
31  contributors may be used to endorse or promote products derived
32  from this software without specific prior written permission.
33 
34  This software is provided by the Copyright holders and contributors "as
35  is" and any express or implied warranties, including, but not limited
36  to, the implied warranties of merchantability and fitness for a
37  particular purpose are disclaimed. In no event shall the Copyright owner
38  or contributors be liable for any direct, indirect, incidental, special,
39  exemplary, or consequential damages (including, but not limited to,
40  procurement of substitute goods or services; loss of use, data, or
41  profits; or business interruption) however caused and on any theory of
42  liability, whether in contract, strict liability, or tort (including
43  negligence or otherwise) arising in any way out of the use of this
44  software, even if advised of the possibility of such damage.
45 */
46 
47 #ifndef STLPLUS_EXCEPTIONS
48 #define STLPLUS_EXCEPTIONS
49 ////////////////////////////////////////////////////////////////////////////////
50 
51 // Author: Andy Rushton
52 // Copyright: (c) Andy Rushton, 2007
53 // License: BSD License, see ../docs/license.html
54 
55 // The set of general exceptions thrown by STLplus components
56 
57 ////////////////////////////////////////////////////////////////////////////////
58 #include "containers_fixes.hpp"
59 #include <stdexcept>
60 #include <string>
61 
62 namespace stlplus
63 {
64 
65  ////////////////////////////////////////////////////////////////////////////////
66  // Thrown if a pointer or an iterator is dereferenced when it is null
67 
68  class null_dereference : public std::logic_error
69  {
70  public:
71  null_dereference(const std::string& description) throw() :
72  std::logic_error(std::string("stlplus::null_dereference: ") + description) {}
73  ~null_dereference(void) throw() {}
74  };
75 
76  ////////////////////////////////////////////////////////////////////////////////
77  // Thrown if an iterator is dereferenced when it is pointing to the end element
78 
79  class end_dereference : public std::logic_error
80  {
81  public:
82  end_dereference(const std::string& description) throw() :
83  std::logic_error("stlplus::end_dereference: " + description) {}
84  ~end_dereference(void) throw() {}
85  };
86 
87  ////////////////////////////////////////////////////////////////////////////////
88  // Thrown if an iterator is used with the wrong container. In other words, an
89  // iterator is created as a pointer to a sub-object within a container. If
90  // that iterator is then used with a different container, this exception is
91  // thrown.
92 
93  class wrong_object : public std::logic_error
94  {
95  public:
96  wrong_object(const std::string& description) throw() :
97  std::logic_error("stlplus::wrong_object: " + description) {}
98  ~wrong_object(void) throw() {}
99  };
100 
101  ////////////////////////////////////////////////////////////////////////////////
102  // Thrown if an attempt is made to copy an object that is uncopyable
103 
104  class illegal_copy : public std::logic_error
105  {
106  public:
107  illegal_copy(const std::string& description) throw() :
108  std::logic_error("stlplus::illegal_copy: " + description) {}
109  ~illegal_copy(void) throw() {}
110  };
111 
112  ////////////////////////////////////////////////////////////////////////////////
113 
114 } // end namespace stlplus
115 
116 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013