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