00001 /****************************************************************************** 00002 * __ _ _ _ _ _ _____ * 00003 * | \ / | | | | | | | | | | ___| * 00004 * | \/ | | | | | | | | | | |_ * 00005 * | | | | | | | | | | | _| * 00006 * | |\/| | | | | |__ | |__ | | | |__ * 00007 * |_| |_| |_| |____| |____| |_| |____| * 00008 * __________________________________________________________________________ * 00009 * Multifunctional Library For Image Processing * 00010 * * 00011 * * 00012 * * 00013 * (c) Copyright 2007 by Humbert Florent * 00014 * * 00015 * This program is free software; you can redistribute it and/or modify * 00016 * it under the terms of the GNU General Public License as published by * 00017 * the Free Software Foundation; only version 2 of the License. * 00018 * * 00019 * This program is distributed in the hope that it will be useful, * 00020 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00022 * GNU General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU General Public License * 00025 * along with this program; if not, write to the Free Software * 00026 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 00027 * 02111-1307, USA. * 00028 ******************************************************************************/ 00029 00032 #ifndef _MILLIEEXCEPTIONS_HPP_ 00033 #define _MILLIEEXCEPTIONS_HPP_ 00034 00035 #include <stdexcept> 00036 #include <iostream> 00037 00043 namespace Millie 00044 { 00045 00051 class Exception : public std::exception 00052 { 00053 private: 00054 std::string _msg; 00055 public: 00056 Exception(const std::string & m); 00057 virtual const char * what() const throw(); 00058 virtual ~Exception() throw(); 00059 }; 00060 00067 class LogicError : public Exception 00068 { 00069 private: 00070 std::string _msg; 00071 public: 00072 LogicError(const std::string & m); 00073 virtual const char * what() const throw(); 00074 virtual ~LogicError() throw(); 00075 }; 00076 00082 class OutOfRange : public LogicError 00083 { 00084 private: 00085 std::string _msg; 00086 public: 00087 OutOfRange(const std::string & m); 00088 virtual const char * what() const throw(); 00089 virtual ~OutOfRange() throw(); 00090 }; 00091 00095 class IllegalArgument : public LogicError 00096 { 00097 private: 00098 std::string _msg; 00099 public: 00100 IllegalArgument(const std::string & m); 00101 virtual const char * what() const throw(); 00102 virtual ~IllegalArgument() throw(); 00103 }; 00104 00108 class NullPointer : public LogicError 00109 { 00110 private: 00111 std::string _msg; 00112 public: 00113 NullPointer(const std::string & m); 00114 virtual const char * what() const throw(); 00115 virtual ~NullPointer() throw(); 00116 }; 00117 00122 class RuntimeException : public Exception 00123 { 00124 private: 00125 std::string _msg; 00126 public: 00127 RuntimeException(const std::string & m); 00128 virtual const char * what() const throw(); 00129 virtual ~RuntimeException() throw(); 00130 }; 00131 00135 class RuntimeThreadException : public RuntimeException 00136 { 00137 private: 00138 std::string _msg; 00139 public: 00140 RuntimeThreadException(const std::string & m); 00141 virtual const char * what() const throw(); 00142 virtual ~RuntimeThreadException() throw(); 00143 00144 }; 00145 00149 class MutexException : public RuntimeException 00150 { 00151 private: 00152 std::string _msg; 00153 public: 00154 MutexException(const std::string & m); 00155 virtual const char * what() const throw(); 00156 virtual ~MutexException() throw(); 00157 }; 00158 00163 class IllegalThreadStateException : public RuntimeThreadException 00164 { 00165 private: 00166 std::string _msg; 00167 public: 00168 IllegalThreadStateException(const std::string & m); 00169 virtual const char * what() const throw(); 00170 virtual ~IllegalThreadStateException() throw(); 00171 00172 }; 00173 00177 class IOException : public RuntimeException 00178 { 00179 private: 00180 std::string _msg; 00181 public: 00182 IOException(const std::string & m); 00183 virtual const char * what() const throw(); 00184 virtual ~IOException() throw(); 00185 }; 00186 00190 class ThreadCreationFailed : public RuntimeException 00191 { 00192 private: 00193 std::string _msg; 00194 public: 00195 ThreadCreationFailed(const std::string &m); 00196 virtual const char * what() const throw(); 00197 virtual ~ThreadCreationFailed() throw(); 00198 }; 00199 } 00200 00201 #endif