Main MRPT website > C++ reference
MRPT logo

exceptions.hpp

Go to the documentation of this file.
00001 /*
00002     The STL+ C++ Library Collection
00003 
00004     Website <http://stlplus.sourceforge.net/> Collection <index.html>
00005 
00006 
00007       License Agreement
00008 
00009     <http://www.opensource.org/>
00010 
00011         * License for using the STLplus Library Collection <#license>
00012         * The Intent of this License <#intent>
00013         * How to Comply with this License <#compliance>
00014         * Historical Note <#history>
00015 
00016 
00017         License for using the STLplus Library Collection
00018 
00019     *© 1999-2008 Andy Rushton. All rights reserved.*
00020 
00021     Redistribution and use in source and binary forms, with or without
00022     modification, are permitted provided that the following conditions are met:
00023 
00024         * Redistributions of source code must retain the above Copyright
00025           notice, this list of conditions and the following disclaimer.
00026         * Redistributions in binary form must reproduce the above Copyright
00027           notice, this list of conditions and the following disclaimer in
00028           the documentation and/or other materials provided with the
00029           distribution.
00030         * Neither the name of the STLplus library nor the names of its
00031           contributors may be used to endorse or promote products derived
00032           from this software without specific prior written permission.
00033 
00034     This software is provided by the Copyright holders and contributors "as
00035     is" and any express or implied warranties, including, but not limited
00036     to, the implied warranties of merchantability and fitness for a
00037     particular purpose are disclaimed. In no event shall the Copyright owner
00038     or contributors be liable for any direct, indirect, incidental, special,
00039     exemplary, or consequential damages (including, but not limited to,
00040     procurement of substitute goods or services; loss of use, data, or
00041     profits; or business interruption) however caused and on any theory of
00042     liability, whether in contract, strict liability, or tort (including
00043     negligence or otherwise) arising in any way out of the use of this
00044     software, even if advised of the possibility of such damage.
00045 */
00046 
00047 #ifndef STLPLUS_EXCEPTIONS
00048 #define STLPLUS_EXCEPTIONS
00049 ////////////////////////////////////////////////////////////////////////////////
00050 
00051 //   Author: Andy Rushton
00052 //   Copyright: (c) Andy Rushton, 2007
00053 //   License:   BSD License, see ../docs/license.html
00054 
00055 //   The set of general exceptions thrown by STLplus components
00056 
00057 ////////////////////////////////////////////////////////////////////////////////
00058 #include "containers_fixes.hpp"
00059 #include <stdexcept>
00060 #include <string>
00061 
00062 namespace stlplus
00063 {
00064 
00065   ////////////////////////////////////////////////////////////////////////////////
00066   // Thrown if a pointer or an iterator is dereferenced when it is null
00067 
00068   class null_dereference : public std::logic_error
00069   {
00070   public:
00071     null_dereference(const std::string& description) throw() :
00072       std::logic_error(std::string("stlplus::null_dereference: ") + description) {}
00073     ~null_dereference(void) throw() {}
00074   };
00075 
00076   ////////////////////////////////////////////////////////////////////////////////
00077   // Thrown if an iterator is dereferenced when it is pointing to the end element
00078 
00079   class end_dereference : public std::logic_error
00080   {
00081   public:
00082     end_dereference(const std::string& description) throw() :
00083       std::logic_error("stlplus::end_dereference: " + description) {}
00084     ~end_dereference(void) throw() {}
00085   };
00086 
00087   ////////////////////////////////////////////////////////////////////////////////
00088   // Thrown if an iterator is used with the wrong container. In other words, an
00089   // iterator is created as a pointer to a sub-object within a container. If
00090   // that iterator is then used with a different container, this exception is
00091   // thrown.
00092 
00093   class wrong_object : public std::logic_error
00094   {
00095   public:
00096     wrong_object(const std::string& description) throw() :
00097       std::logic_error("stlplus::wrong_object: " + description) {}
00098     ~wrong_object(void) throw() {}
00099   };
00100 
00101   ////////////////////////////////////////////////////////////////////////////////
00102   // Thrown if an attempt is made to copy an object that is uncopyable
00103 
00104   class illegal_copy : public std::logic_error
00105   {
00106   public:
00107     illegal_copy(const std::string& description) throw() :
00108       std::logic_error("stlplus::illegal_copy: " + description) {}
00109     ~illegal_copy(void) throw() {}
00110   };
00111 
00112   ////////////////////////////////////////////////////////////////////////////////
00113 
00114 } // end namespace stlplus
00115 
00116 #endif



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:40:17 UTC 2011