00001 /***************************************************************************\ 00002 * Copyright (C) by University Paris-Est - MISS team 00003 * GeometryException.hpp created in 3 2009. 00004 * Mail : biri@univ-mlv.fr 00005 * 00006 * This file is part of the OpenKraken-geometry. 00007 * 00008 * The OpenKraken-geometry is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation; either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * The OpenKraken-geometry is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 * 00021 \***************************************************************************/ 00022 00023 /* 00024 * Anti-doublon 00025 */ 00026 #ifndef __OPENKN_GEOMETRY__GEOMETRYEXCEPTION_HPP__ 00027 #define __OPENKN_GEOMETRY__GEOMETRYEXCEPTION_HPP__ 00028 00029 /* 00030 * External Includes 00031 */ 00032 #include <iostream> 00033 #include <string> 00034 #include <exception> 00035 00036 /* 00037 * Internal Includes 00038 */ 00039 00040 /* 00041 * Namespace 00042 */ 00043 namespace kn{ 00044 00045 /* 00046 * Class definition 00047 */ 00048 00052 class GeometryException : std::exception { 00053 00054 /* 00055 * Constructor & destructors 00056 */ 00057 public: 00058 00063 GeometryException(const std::string& err="", const std::string& funcname=""); 00064 00068 GeometryException(const GeometryException & e); 00069 00072 ~GeometryException() throw() {} 00073 00074 private : 00075 00078 std::string str; 00079 00080 public : 00081 00085 inline std::string errorString() const {return str;} 00086 00090 virtual const char* what() const throw() {return str.c_str();} 00091 }; 00092 00098 inline std::ostream& operator <<(std::ostream& stream, const GeometryException & err){ 00099 return stream << err.errorString(); 00100 } 00101 00102 /* 00103 * End of Namespace 00104 */ 00105 } 00106 00107 /* 00108 * End of Anti-doublon 00109 */ 00110 #endif